Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-6795

Stats never runs. stats_monthly table gets very full

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6
    • 1.7.1, 1.8
    • Administration
    • None
    • All
    • Any
    • MOODLE_16_STABLE
    • MOODLE_17_STABLE, MOODLE_18_STABLE

    Description

      I'm trying to get the stats to work on a 1.6.1+ install (also 1.6.2). It seems to run away and never return. I set the stats settings so that it only went back a week, but it still never seems to end.

      Info:
      1. Site has about 125 courses.
      2. 800 users.
      3. Stats settings are set to look one week back and run no longer than an hour.
      4. After running for more than an hour, the 'stats_monthly' table has 2,344,571 records in it (it started empty), 'stats_daily', 'stats_user_daily' and 'stats_user_monthly' are empty, 'stats_user_weekly' has 195 records, and 'stats_weekly' has 136 records.
      5. If I access the stats functions, I get the message "There is no available data to display, sorry".

      After running some tests we discovered that the run ends up in an infinite loop in the 'stats_cron_monthly' function. In particular, the iterator of the loop, function stats_get_next_monthend, never increments the value. It stays the same.

      The function stats_get_next_monthend is doing some funky stuff with timestamps. The code reads:

      function stats_get_next_monthend($lastmonth) {
      return stats_getmidnight(strtotime(date('1-M-Y',$lastmonth).' +1 month'));
      }

      Attachments

        Issue Links

          Activity

            People

              mjollnir Penny Leach
              mchurch Mike Churchward
              Nobody Nobody
              Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                17/Jan/07