Skip to content

Commit

Permalink
Merge branch 'MDL-33430-reference-restore' of git://github.com/mudrd8…
Browse files Browse the repository at this point in the history
…mz/moodle

Conflicts:
	lib/db/install.xml
	lib/db/upgrade.php
	version.php
  • Loading branch information
Sam Hemelryk committed Jun 21, 2012
2 parents a273391 + 7b5f67f commit 088c374
Show file tree
Hide file tree
Showing 13 changed files with 522 additions and 55 deletions.
13 changes: 7 additions & 6 deletions backup/moodle2/backup_stepslib.php
Expand Up @@ -1404,20 +1404,21 @@ protected function define_structure() {
'contenthash', 'contextid', 'component', 'filearea', 'itemid',
'filepath', 'filename', 'userid', 'filesize',
'mimetype', 'status', 'timecreated', 'timemodified',
'source', 'author', 'license', 'sortorder', 'reference', 'repositoryid'));
'source', 'author', 'license', 'sortorder',
'repositorytype', 'repositoryid', 'reference'));

// Build the tree

$files->add_child($file);

// Define sources

$file->set_source_sql("SELECT f.*, r.repositoryid, r.reference
$file->set_source_sql("SELECT f.*, r.type AS repositorytype, fr.repositoryid, fr.reference
FROM {files} f
LEFT JOIN {files_reference} r
ON r.id = f.referencefileid
JOIN {backup_ids_temp} bi
ON f.id = bi.itemid
LEFT JOIN {files_reference} fr ON fr.id = f.referencefileid
LEFT JOIN {repository_instances} ri ON ri.id = fr.repositoryid
LEFT JOIN {repository} r ON r.id = ri.typeid
JOIN {backup_ids_temp} bi ON f.id = bi.itemid
WHERE bi.backupid = ?
AND bi.itemname = 'filefinal'", array(backup::VAR_BACKUPID));

Expand Down
8 changes: 7 additions & 1 deletion backup/moodle2/restore_final_task.class.php
Expand Up @@ -83,9 +83,15 @@ public function build() {
// executing it to perform some final adjustments of information
// not available when the task was executed.
// This step is always the last one performing modifications on restored information
// Don't add any new step after it. Only cache rebuild and clean are allowed.
// Don't add any new step after it. Only aliases queue, cache rebuild and clean are allowed.
$this->add_step(new restore_execute_after_restore('executing_after_restore'));

// All files were sent to the filepool by now. We need to process
// the aliases yet as they were not actually created but stashed for us instead.
// We execute this step after executing_after_restore so that there can't be no
// more files sent to the filepool after this.
$this->add_step(new restore_process_file_aliases_queue('process_file_aliases_queue'));

// Rebuild course cache to see results, whoah!
$this->add_step(new restore_rebuild_course_cache('rebuild_course_cache'));

Expand Down

0 comments on commit 088c374

Please sign in to comment.