-
Sub-task
-
Resolution: Fixed
-
Minor
-
1.6, 1.6.1, 1.6.2, 1.6.3
-
None
-
PHP 5.2
-
MOODLE_16_STABLE
-
MOODLE_19_STABLE
Bug discovered with Moodle 1.6.3 on Linux 2.6 and PHP 5.2 .
Gather of statistics always starts 24 hours after the precedent gather.
I debug and found that at line #280 of file admin/cron.php strtotime function always returns 00:00 (today morning):
$timetocheck = strtotime("$CFG->statsruntimestarthour:$CFG->statsruntimestartminute today");
Indeed "today" parameter is not recognized by PHP.
Therefore the comparison (time() > $timetocheck) is always true. However statistics are (generally) not processed but delayed (until precedent gathering time) because of time interval of 24 hours specified in stats_cron_daily function about line #70 of lib/statslib.php.
So I have deleted this parameter:
$timetocheck = strtotime("$CFG->statsruntimestarthour:$CFG->statsruntimestartminute");
May be a link with this PHP warning:
<< In PHP 5 up to 5.0.2, "now" and other relative times are wrongly computed from today's midnight. It differs from other versions where it is correctly computed from current time. >>
http://fr3.php.net/manual/en/function.strtotime.php
And, now, it works fine: gather of statistics always starts at 22:00.