mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 09:05:49 +00:00
Get MultiFormPurgeTask to actually work.
* `run()` is part of BuildTask not DailyTask * `$session->delete()` doesn't return anything so the conditional will never be true * Updated comments.
This commit is contained in:
parent
d9683b69ef
commit
6a4dc5dc80
@ -5,8 +5,10 @@
|
||||
*
|
||||
* Setup Instructions:
|
||||
* You need to create an automated task for your system (cronjobs on unix)
|
||||
* which triggers the run() method through cli-script.php:
|
||||
* /your/path/sapphire/cli-script.php MultiFormPurgeTask/run
|
||||
* which triggers the process() method through cli-script.php:
|
||||
* `php framework/cli-script.php MultiFormPurgeTask`
|
||||
* or
|
||||
* `framework/sake MultiFormPurgeTask`
|
||||
*
|
||||
* @package multiform
|
||||
*/
|
||||
@ -27,11 +29,12 @@ class MultiFormPurgeTask extends DailyTask {
|
||||
* are older than the days specified in $session_expiry_days
|
||||
* and delete them.
|
||||
*/
|
||||
public function run() {
|
||||
public function process() {
|
||||
$sessions = $this->getExpiredSessions();
|
||||
$delCount = 0;
|
||||
if($sessions) foreach($sessions as $session) {
|
||||
if($session->delete()) $delCount++;
|
||||
$session->delete();
|
||||
$delCount++;
|
||||
}
|
||||
echo $delCount . ' session records deleted that were older than ' . self::$session_expiry_days . ' days.';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user