Permalink
Browse files

Merge branch 'MDL-33430-reference-restore' of git://github.com/mudrd8…

…mz/moodle

Conflicts:
	lib/db/install.xml
	lib/db/upgrade.php
	version.php
  • Loading branch information...
2 parents a273391 + 7b5f67f commit 088c374a6d306f4bbb0ad26c099e29c4be645a23 Sam Hemelryk committed Jun 21, 2012
@@ -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));
@@ -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'));
Oops, something went wrong.

0 comments on commit 088c374

Please sign in to comment.