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

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6, 1.6.1, 1.6.2, 1.6.3
    • Fix Version/s: 1.9
    • Component/s: Administration
    • Labels:
      None
    • Environment:
      PHP 5.2
    • Affected Branches:
      MOODLE_16_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            skodak Petr Skoda
            Reporter:
            saint-georges Arnaud saint-Georges
            Tester:
            Nobody
            Participants:
            Component watchers:
            Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              3/Mar/08