Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-13192 stats cleanup - meta
  3. MDL-8124

Gather of stistics doesn't start at settled time

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: Minor Minor
    • 1.9
    • 1.6, 1.6.1, 1.6.2, 1.6.3
    • Administration
    • 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.

            skodak Petr Skoda
            saint-georges Arnaud saint-Georges (Inactive)
            Nobody Nobody (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.