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:
Trevor 2013-10-15 14:12:45 +11:00
parent d9683b69ef
commit 6a4dc5dc80
1 changed files with 7 additions and 4 deletions

View File

@ -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.';
}