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

Add $logextra parameter to restore_legacy() in base event class

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • None
    • 2.9
    • Events API

      My patch in MDL-34867 included fixes to improve the performance of downloading log data where the parameter $logextra was added to the restore_legacy() function in the event base class so that additional course and user data could be passed. This is being addressed as a separate issue as the peer review suggested.
      The existing function restore() in the event base class also already accepts the $logextra argument. I've attached a patch for what these changes look like.

      New changes in lib/classes/event/base.php:

            * @param \stdClass $legacy
      +     * @param array $logextra Additional properties of the log
            * @return base
            */
      -    public static final function restore_legacy($legacy) {
      +    public static final function restore_legacy($legacy, array $logextra) {
               $classname = get_called_class();
               /** @var base $event */
               $event = new $classname();
      @@ -463,7 +464,7 @@ abstract class base implements \IteratorAggregate {
               $event->data['relateduserid'] = ($legacy->userid ? $legacy->userid : null);
               $event->data['timecreated'] = $legacy->time;
       
      -        $event->logextra = array();
      +        $event->logextra = $logextra;
      

      Existing $extralog parameter in lib/classes/event/base.php

          /**
           * Restore event from existing historic data.
           *
           * @param array $data
           * @param array $logextra the format is standardised by logging API
           * @return bool|\core\event\base
           */
          public static final function restore(array $data, array $logextra) {
      

            tbannister Tyler Bannister
            tgus Tim Gus
            Ankit Agarwal Ankit Agarwal
            Dan Poltawski Dan Poltawski
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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