mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
Merge branch 'MDL-74597' of https://github.com/paulholden/moodle
This commit is contained in:
commit
586f79f15b
@ -3235,8 +3235,13 @@ privatefiles,moodle|/user/files.php';
|
||||
set_config('customusermenuitems', $newcustomusermenuitems);
|
||||
} else {
|
||||
// If the site is not using the old defaults, only add necessary entries.
|
||||
$lines = explode("\n", $currentcustomusermenuitems);
|
||||
$lines = array_map('trim', $lines);
|
||||
$lines = preg_split('/\n/', $currentcustomusermenuitems, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$lines = array_map(static function(string $line): string {
|
||||
// Previous format was "<langstring>|<url>[|<pixicon>]" - pix icon is no longer supported.
|
||||
$lineparts = explode('|', trim($line), 3);
|
||||
// Return first two parts of line.
|
||||
return implode('|', array_slice($lineparts, 0, 2));
|
||||
}, $lines);
|
||||
|
||||
// Remove the Preference entry from the menu to prevent duplication
|
||||
// since it will be added again in user_get_user_navigation_info().
|
||||
@ -4565,5 +4570,22 @@ privatefiles,moodle|/user/files.php';
|
||||
upgrade_main_savepoint(true, 2022060300.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2022061000.01) {
|
||||
// Iterate over custom user menu items configuration, removing pix icon references.
|
||||
$customusermenuitems = str_replace(["\r\n", "\r"], "\n", $CFG->customusermenuitems);
|
||||
|
||||
$lines = preg_split('/\n/', $customusermenuitems, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$lines = array_map(static function(string $line): string {
|
||||
// Previous format was "<langstring>|<url>[|<pixicon>]" - pix icon is no longer supported.
|
||||
$lineparts = explode('|', trim($line), 3);
|
||||
// Return first two parts of line.
|
||||
return implode('|', array_slice($lineparts, 0, 2));
|
||||
}, $lines);
|
||||
|
||||
set_config('customusermenuitems', implode("\n", $lines));
|
||||
|
||||
upgrade_main_savepoint(true, 2022061000.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user