Skip to content

Commit

Permalink
MDL-23478 backup - change in block positions structure. Break BC, so …
Browse files Browse the repository at this point in the history
…up minversion
  • Loading branch information
stronk7 committed Jul 24, 2010
1 parent 821aa03 commit 2d7cd79
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion backup/backup.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ abstract class backup implements checksumable {
const OPERATION_RESTORE ='restore';// We are performing one restore

// Version (to keep CFG->backup_version (and release) updated automatically)
const VERSION = 2010072000;
const VERSION = 2010072300;
const RELEASE = '2.0 Preview 5';
}

Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/backup_block_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function build() {
$this->add_step(new backup_block_instance_structure_step('block_commons', 'block.xml'));

// Here we add all the common steps for any block and, in the point of interest
// we call to define_my_steps() is order to get the particular ones inserted in place.
// we call to define_my_steps() in order to get the particular ones inserted in place.
$this->define_my_steps();

// Generate the roles file (optionally role assignments and always role overrides)
Expand Down
7 changes: 5 additions & 2 deletions backup/moodle2/backup_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1020,13 +1020,16 @@ protected function define_structure() {
'blockname', 'parentcontextid', 'showinsubcontexts', 'pagetypepattern',
'subpagepattern', 'defaultregion', 'defaultweight', 'configdata'));

$positions = new backup_nested_element('block_positions', null, array(
$positions = new backup_nested_element('block_positions');

$position = new backup_nested_element('block_position', array('id'), array(
'contextid', 'pagetype', 'subpage', 'visible',
'region', 'weight'));

// Build the tree

$block->add_child($positions);
$positions->add_child($position);

// Transform configdata information if needed (process links and friends)
$blockrec = $DB->get_record('block_instances', array('id' => $this->task->get_blockid()));
Expand All @@ -1047,7 +1050,7 @@ protected function define_structure() {

$block->set_source_array(array($blockrec));

$positions->set_source_table('block_positions', array('blockinstanceid' => backup::VAR_PARENTID));
$position->set_source_table('block_positions', array('blockinstanceid' => backup::VAR_PARENTID));

// File anotations (for fileareas specified on each block)
foreach ($this->task->get_fileareas() as $filearea) {
Expand Down
2 changes: 1 addition & 1 deletion backup/util/helper/restore_prechecks_helper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function execute_prechecks($controller, $droptemptablesafter = fal
restore_controller_dbops::create_restore_temp_tables($controller->get_restoreid());

// Check we are restoring one backup >= $min20version (very first ok ever)
$min20version = 2010072000;
$min20version = 2010072300;
if ($controller->get_info()->backup_version < $min20version) {
$message = new stdclass();
$message->backup = $controller->get_info()->backup_version;
Expand Down
1 change: 1 addition & 0 deletions backup/util/plan/backup_structure_step.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function __construct($name, $filename, $task = null) {
throw new backup_step_exception('wrong_backup_task_specified');
}
$this->filename = $filename;
$this->contenttransformer = null;
parent::__construct($name, $task);
}

Expand Down
10 changes: 9 additions & 1 deletion backup/util/plan/restore_structure_step.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
abstract class restore_structure_step extends restore_step {

protected $filename; // Name of the file to be parsed
protected $pathelements; // Array of pathelements to process
protected $contentprocessor; // xml parser processor being used
// (need it here, apart from parser
// thanks to serialized data to process -
// say thanks to blocks!)
protected $pathelements; // Array of pathelements to process
protected $elementsoldid; // Array to store last oldid used on each element
protected $elementsnewid; // Array to store last newid used on each element

Expand All @@ -42,6 +46,7 @@ public function __construct($name, $filename, $task = null) {
throw new restore_step_exception('wrong_restore_task_specified');
}
$this->filename = $filename;
$this->contentprocessor = null;
$this->pathelements = array();
$this->elementsoldid = array();
$this->elementsnewid = array();
Expand Down Expand Up @@ -82,6 +87,9 @@ public function execute() {
$xmlparser = new progressive_parser();
$xmlparser->set_file($fullpath);
$xmlprocessor = new restore_structure_parser_processor($this->task->get_courseid(), $this);
$this->contentprocessor = $xmlprocessor; // Save the reference to the contentprocessor
// as far as we are going to need it out
// from parser (blame serialized data!)
$xmlparser->set_processor($xmlprocessor);

// Add pathelements to processor
Expand Down

0 comments on commit 2d7cd79

Please sign in to comment.