Permalink
Browse files

MDL-27822 old module version should be available in restore_activity_…

…structure_step::define_structure()
  • Loading branch information...
1 parent d527599 commit d4e94648cf4b0b53646fbc5432bb40fe16be92da @timhunt timhunt committed with stronk7 Jun 10, 2011
Showing with 12 additions and 1 deletion.
  1. +10 −1 backup/moodle2/restore_activity_task.class.php
  2. +2 −0 backup/moodle2/restore_stepslib.php
View
11 backup/moodle2/restore_activity_task.class.php
@@ -34,6 +34,7 @@
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 @@
* 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 @@ public function set_moduleid($moduleid) {
$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 @@ public function get_moduleid() {
return $this->moduleid;
}
+ public function get_old_module_version() {
+ return $this->oldmoduleversion;
+ }
+
public function get_activityid() {
return $this->activityid;
}
View
2 backup/moodle2/restore_stepslib.php
@@ -2025,6 +2025,8 @@ protected function process_module($data) {
$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)

0 comments on commit d4e9464

Please sign in to comment.