MDL-65313 core: upgrade code to remove stale favourites for messaging
These were left behing when deleting a group or a course.
This commit is contained in:
@@ -3301,5 +3301,21 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2019042700.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2019050300.01) {
|
||||
// Delete all stale favourite records which were left behind when a course was deleted.
|
||||
$select = 'id IN (
|
||||
SELECT fav.id as id
|
||||
FROM {favourite} fav
|
||||
LEFT JOIN {context} ctx ON (ctx.id = fav.contextid)
|
||||
WHERE fav.component = :component
|
||||
AND fav.itemtype = :itemtype
|
||||
AND ctx.id IS NULL
|
||||
)';
|
||||
$params = ['component' => 'core_message', 'itemtype' => 'message_conversations'];
|
||||
$DB->delete_records_select('favourite', $select, $params);
|
||||
|
||||
upgrade_main_savepoint(true, 2019050300.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2019050300.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2019050300.01; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user