Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-27171 messages: clean up pereferences on message provider removal

Signed-off-by: Ruslan Kabalin <ruslan.kabalin@luns.net.uk>
  • Loading branch information...
commit 298925d4d10b58a8feeb50975aca219dd29ce4d1 1 parent 31afb0a
Ruslan Kabalin authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/messagelib.php
4 lib/messagelib.php
View
@@ -211,7 +211,7 @@ function message_update_providers($component='moodle') {
foreach ($fileproviders as $messagename => $fileprovider) {
if (!empty($dbproviders[$messagename])) { // Already exists in the database
-
+ // check if capability has changed
if ($dbproviders[$messagename]->capability == $fileprovider['capability']) { // Same, so ignore
// exact same message provider already present in db, ignore this entry
unset($dbproviders[$messagename]);
@@ -242,6 +242,8 @@ function message_update_providers($component='moodle') {
foreach ($dbproviders as $dbprovider) { // Delete old ones
$DB->delete_records('message_providers', array('id' => $dbprovider->id));
+ $DB->delete_records_select('config_plugins', "plugin = 'message' AND ".$DB->sql_like('name', '?', false), array("%_provider_{$component}_{$dbprovider->name}_%"));
+ $DB->delete_records_select('user_preferences', $DB->sql_like('name', '?', false), array("message_provider_{$component}_{$dbprovider->name}_%"));
}
return true;
Please sign in to comment.
Something went wrong with that request. Please try again.