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

use 'restore' and 'ws' origin in logged events

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: 2.7
    • Component/s: Backup, Events API
    • Labels:
    • Testing Instructions:
      Hide

      1/ execute phpunit tests
      2/ enable standard logging (not the legacy one which is enabled by default)
      3/ execute some logged web service function (using the built-in Web service test client)
      4/ verify the origin in standard log table

      Show
      1/ execute phpunit tests 2/ enable standard logging (not the legacy one which is enabled by default) 3/ execute some logged web service function (using the built-in Web service test client) 4/ verify the origin in standard log table
    • Affected Branches:
      MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w13_MDL-44106_m27_requestorig
    • Story Points:
      20
    • Sprint:
      BACKEND Sprint 12

      Description

      Current problem

      Problem is that we cannot just falsify log history by injecting log records from the restore file, events must be always triggered and we need to know where are the courses coming from, that means the restore process needs to log everything that is happening during restore.

      • import (=== backup+restore) of activities should not try to restore any logs
      • restore from different site cannot create log entries with non-existent users
      • duplication of course (restore into new course) may bork stats
      • statistics should probably ignore the events coming from restore completely

      Possible solutions

      A/ use events

      1/ trigger \core\event\restore_started and \core\event\restore_finished events (this might be useful in any case)
      2/ log writers would watch for these and start adding 'restore' origin when writing events to storage during the restore process

      B/ new $PAGE->get_request_origin()

      The idea is to have one method that tells you if you are doing something from normal page, ws, cli, restore. The restore code would use some private API to tell PAGE that restore starts/end or it could even use 1/, but that would require a new observer which does not seem optimal to me. At the same time we could add $PAGE->get_request_ip().

      After A/ or B/ is implemented we could filter out logs coming from the restore process in stats and other areas where we want to ignore the events triggered during restore.

      The next step would be to optionally restore the original log data - we would need backup/restore support in log stores and new method in base event class which would have to be overridden by events that can recalculate the ids.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/May/14