diff --git a/backup/moodle2/restore_activity_task.class.php b/backup/moodle2/restore_activity_task.class.php index 51962c2d7e1..c7f0e5c8de8 100644 --- a/backup/moodle2/restore_activity_task.class.php +++ b/backup/moodle2/restore_activity_task.class.php @@ -34,6 +34,7 @@ abstract class restore_activity_task extends restore_task { protected $modulename; // name of the module protected $moduleid; // new (target) id of the course module protected $oldmoduleid; // old (original) id of the course module + protected $oldmoduleversion; // old (original) version of the module protected $contextid; // new (target) context of the activity protected $oldcontextid;// old (original) context of the activity protected $activityid; // new (target) id of the activity @@ -43,11 +44,11 @@ abstract class restore_activity_task extends restore_task { * Constructor - instantiates one object of this class */ public function __construct($name, $info, $plan = null) { - $this->info = $info; $this->modulename = $this->info->modulename; $this->moduleid = 0; $this->oldmoduleid = $this->info->moduleid; + $this->oldmoduleversion = 0; $this->contextid = 0; $this->oldcontextid = 0; $this->activityid = 0; @@ -66,6 +67,10 @@ abstract class restore_activity_task extends restore_task { $this->moduleid = $moduleid; } + public function set_old_module_version($oldmoduleversion) { + $this->oldmoduleversion = $oldmoduleversion; + } + public function set_activityid($activityid) { $this->activityid = $activityid; } @@ -90,6 +95,10 @@ abstract class restore_activity_task extends restore_task { return $this->moduleid; } + public function get_old_module_version() { + return $this->oldmoduleversion; + } + public function get_activityid() { return $this->activityid; } diff --git a/backup/moodle2/restore_stepslib.php b/backup/moodle2/restore_stepslib.php index 7c66910ee5f..78ccccc9df7 100644 --- a/backup/moodle2/restore_stepslib.php +++ b/backup/moodle2/restore_stepslib.php @@ -2025,6 +2025,8 @@ class restore_module_structure_step extends restore_structure_step { $data = (object)$data; $oldid = $data->id; + $this->task->set_old_module_version($data->version); + $data->course = $this->task->get_courseid(); $data->module = $DB->get_field('modules', 'id', array('name' => $data->modulename)); // Map section (first try by course_section mapping match. Useful in course and section restores)