MDL-21432 backup - fix some get_userid() calls
authorEloy Lafuente <stronk7@moodle.org>
Thu, 22 Jul 2010 08:19:21 +0000 (08:19 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Thu, 22 Jul 2010 08:19:21 +0000 (08:19 +0000)
backup/moodle2/restore_stepslib.php
backup/util/plan/restore_structure_step.class.php

index 9dcb7cc..be2bc8a 100644 (file)
@@ -358,7 +358,7 @@ class restore_scales_structure_step extends restore_structure_step {
                                         ORDER BY courseid", $params, IGNORE_MULTIPLE)) {
             // Remap the user if possible, defaut to user performing the restore if not
             $userid = $this->get_mappingid('user', $data->userid);
-            $data->userid = $userid ? $userid : $this->get_userid();
+            $data->userid = $userid ? $userid : $this->task->get_userid();
             // Remap the course if course scale
             $data->courseid = $data->courseid ? $this->get_courseid() : 0;
             // If global scale (course=0), check the user has perms to create it
@@ -418,7 +418,7 @@ class restore_outcomes_structure_step extends restore_structure_step {
                                          ORDER BY COALESCE(courseid, 0)', $params, IGNORE_MULTIPLE)) {
             // Remap the user
             $userid = $this->get_mappingid('user', $data->usermodified);
-            $data->usermodified = $userid ? $userid : $this->get_userid();
+            $data->usermodified = $userid ? $userid : $this->task->get_userid();
             // Remap the scale
             $data->scaleid = $this->get_mappingid('scale', $data->scaleid);
             // Remap the course if course outcome
index 500bb81..084591a 100644 (file)
@@ -286,7 +286,7 @@ abstract class restore_structure_step extends restore_step {
         // Re-enforce 'moodle/restore:rolldates' capability for the user in the course, just in case
         } else if (!has_capability('moodle/restore:rolldates',
                                    get_context_instance(CONTEXT_COURSE, $this->get_courseid()),
-                                   $this->get_userid())) {
+                                   $this->task->get_userid())) {
             $cache[$this->get_restoreid()] = 0;
 
         // Arrived here, let's calculate the real offset