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

Log dates incorrect when course is restored WITH the activity log and the course start date is rolled forward

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Goto Dashboard / ► Site administration / ► Plugins / ► Logging / ► Manage log stores
      2. Enable all three logstores. You will also need to configure the database logstore.
      3. Enable "loglegacy" config
      4. Do some activities in a course (like forum post, visit log report, make submissions etc ) that creates log entries.
      5. Visit course log report and verify there are entries in all log stores. Make a rough note of the times (you don't need exact timestamps) of some of the log entries.
      6. Backup the course with user and log data.
      7. Restore this course as a new course. (change course start date to the year 2020 AUG during restore)
      8. Make sure the log dates in the new course are still the same and are not rolled forward. (check this for restored log entries only, your actions in the course might have created new log entries, also restore creates a lot of new entries.)
      9. Test this for all log stores.
      Show
      Goto Dashboard / ► Site administration / ► Plugins / ► Logging / ► Manage log stores Enable all three logstores. You will also need to configure the database logstore. Enable "loglegacy" config Do some activities in a course (like forum post, visit log report, make submissions etc ) that creates log entries. Visit course log report and verify there are entries in all log stores. Make a rough note of the times (you don't need exact timestamps) of some of the log entries. Backup the course with user and log data. Restore this course as a new course. (change course start date to the year 2020 AUG during restore) Make sure the log dates in the new course are still the same and are not rolled forward. (check this for restored log entries only, your actions in the course might have created new log entries, also restore creates a lot of new entries.) Test this for all log stores.
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Pull 3.3 Branch:
    • Pull Master Branch:
      MDL-44961-master
    • Sprint:
      3.4 Sprint 1

      Description

      We believe have found a big log / stats issue and have confirmed another school has the same problem.. which could make the stats/log report no longer correct or inaccurate.

      My colleague inquired about this...

      https://moodle.org/mod/forum/discuss.php?d=255513#p1115613

      I've recently noticed that our mdl_log file contains dates all the way into the year 2018! After investigating this for hours, I've discovered that this is caused when a course is restored WITH the activity log and the course start date is rolled forward. If the new start date is 173 days later that it was in the course being restored, then all of the dates in the logs are updated to be 173 days later – even if that date hasn't yet occurred. The log file now contains double the records and the new ones are completely false, but will still affect the statistics when they are reported.

      I realize that it is a user error to restore course logs when restoring it to create a copy for the future. However, I don't understand why the roll would even touch those records. Logs are sacred. You'd think there would be some way to ensure there are no future dates in a log file!

      The other problem is that when a course is deleted, so are the log records! This is terrible when you're running statistics! I just don't understand why these records are being manipulated this way. Am I looking at the wrong table? Is there another one that I should be looking at?

      I feel like I must be missing something important.

      =========================
      From the other school ...
      =========================

      This is exactly what I am seeing.

      I just did a test which gave me the same results. Created a course, TestDates_2014CRS, added a couple of users, had them do a couple of transactions, backed it up with users, logs and history, then restored it with all user data and logs and a start date 1 year after the original start date.
      When I first looked at the course logs, the dates were correct, but when I looked at the participant logs, they were out by a year, then when I went back to the course logs, those were also out by a year.

      Thank you for finding this Lawrence; is there anything we can do to correct this now we know what the problem is?

      ---------------------------------------------------------------------------

      From the similar issue MDL-47743 that was closed as a duplicate of this:
      Courses backed up in 2.5.4+ are restored into 2.6.5+. Student activty logs of restored course are not viable (activity dates default to the day of the restore), ip address, action, information fields are blank or gibberish.
      This was fixed in MDL-48644

      Also please see discussion on MDL-9367 (deferred in favour of this issue)

        Attachments

        1. hihi.gliffy
          2 kB
        2. MDL-44961-master.mdk.patch
          2 kB
        3. moms.gliffy
          31 kB

          Issue Links

            Activity

              People

              • Votes:
                13 Vote for this issue
                Watchers:
                18 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  8/May/17