MDL-49987 upgrade: Make sure messages is in the user menu
Because we have removed messages from the navigation tree, it is important that it exists in the user menu. That is the default behaviour, but if sites previously removed it, we need to make sure it is inserted back.
This commit is contained in:
@@ -4337,5 +4337,26 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2015040900.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015050300.00) {
|
||||
// Make sure we have messages in the user menu because it's no longer in the nav tree.
|
||||
$oldconfig = get_config('core', 'customusermenuitems');
|
||||
$mymessagesconfig = "messages,message|/message/index.php|message";
|
||||
$mypreferencesconfig = "mypreferences,moodle|/user/preferences.php|preferences";
|
||||
|
||||
// See if it exists.
|
||||
if (strpos($oldconfig, $mymessagesconfig) === false) {
|
||||
// See if mypreferences exists.
|
||||
if (strpos($oldconfig, "mypreferences,moodle|/user/preferences.php|preferences") !== false) {
|
||||
// Insert it before my preferences.
|
||||
$newconfig = str_replace($mypreferencesconfig, $mymessagesconfig . "\n" . $mypreferencesconfig, $oldconfig);
|
||||
} else {
|
||||
// Custom config - we can only insert it at the end.
|
||||
$newconfig = $oldconfig . "\n" . $mymessagesconfig;
|
||||
}
|
||||
set_config('customusermenuitems', $newconfig);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2015050300.00);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2015050100.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2015050300.00; // 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