MDL-27822 old module version should be available in restore_activity_structure_step::define_structure()

This commit is contained in:
Tim Hunt
2011-06-14 00:34:50 +02:00
committed by Eloy Lafuente (stronk7)
parent d527599fcd
commit d4e94648cf
2 changed files with 12 additions and 1 deletions
+10 -1
View File
@@ -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;
}
+2
View File
@@ -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)