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

Stats never runs. stats_monthly table gets very full


    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.7.1, 1.8
    • 1.6
    • Administration
    • None
    • All
    • Any

      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.

      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'));

            mjollnir Penny Leach
            mchurch Mike Churchward
            Nobody Nobody
            1 Vote for this issue
            4 Start watching this issue


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