mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-38314 repository: Remove orphan repository instances
This commit is contained in:
parent
f0d37f4ac5
commit
4aa4d88da8
2 changed files with 15 additions and 1 deletions
|
@ -2190,5 +2190,19 @@ function xmldb_main_upgrade($oldversion) {
|
||||||
upgrade_main_savepoint(true, 2013061700.00);
|
upgrade_main_savepoint(true, 2013061700.00);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($oldversion < 2013062700.01) {
|
||||||
|
|
||||||
|
// Remove orphan repository instances.
|
||||||
|
$sql = 'SELECT contextid FROM {repository_instances} ri
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT id FROM {context} c
|
||||||
|
WHERE c.id = ri.contextid)';
|
||||||
|
$ids = $DB->get_fieldset_sql($sql);
|
||||||
|
$DB->delete_records_list('repository_instances', 'contextid', $ids);
|
||||||
|
|
||||||
|
// Main savepoint reached.
|
||||||
|
upgrade_main_savepoint(true, 2013062700.01);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
$version = 2013062700.00; // YYYYMMDD = weekly release date of this DEV branch
|
$version = 2013062700.01; // YYYYMMDD = weekly release date of this DEV branch
|
||||||
// RR = release increments - 00 in DEV branches
|
// RR = release increments - 00 in DEV branches
|
||||||
// .XX = incremental changes
|
// .XX = incremental changes
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue