First real test was today and while the emails were sent, the task executed itself 3 times within a matter of seconds, ie each recipient got 3 emails.
Any idea why this would be?
The test function is:
Code: Select all
public function test($time = '')
{
// Only perform this task daily.
if( !$time ) $time = time();
$last_execute = get_site_preference(self::LASTEXECUTE_SITEPREF,0);
if( ($time - 24*60*60) >= $last_execute ) {
return TRUE;
}
return FALSE;
}
Code: Select all
public function test($time = '') {
$lifetime = (int) get_site_preference(self::LIFETIME_SITEPREF, (60 * 60 * 24 * 31));
if ($lifetime == -1) return FALSE; //only manual pruning
// do we need to do this task.
// we only do it daily.
if (!$time) $time = time();
$last_execute = get_site_preference(self::LASTEXECUTE_SITEPREF, 0);
if (($time - 24 * 60 * 60) >= $last_execute) {
return TRUE;
}
return FALSE;
}
Would it be better to change the comparison to strings showing only Y-m-d? and if the day is greater, then execute?
The only other tasks in the directory are those that come standard with CMSMS, ClearCache, GatherNotifications and PruneAdminlog.
Suggestions for a solution welcome.
Thx
psy