Skip to content

Commit

Permalink
Merge branch 'MDL-74597-400' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
…into MOODLE_400_STABLE
  • Loading branch information
junpataleta committed Jun 14, 2022
2 parents fb5e0c4 + 79651c7 commit 2d9c344
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
26 changes: 24 additions & 2 deletions lib/db/upgrade.php
Expand Up @@ -3235,8 +3235,13 @@ function xmldb_main_upgrade($oldversion) {
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().
Expand Down Expand Up @@ -4514,5 +4519,22 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2022041901.05);
}

if ($oldversion < 2022041901.07) {
// 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, 2022041901.07);
}

return true;
}
2 changes: 1 addition & 1 deletion version.php
Expand Up @@ -29,7 +29,7 @@

defined('MOODLE_INTERNAL') || die();

$version = 2022041901.06; // 20220419 = branching date YYYYMMDD - do not modify!
$version = 2022041901.07; // 20220419 = branching date YYYYMMDD - do not modify!
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '4.0.1+ (Build: 20220610)'; // Human-friendly version name
Expand Down

0 comments on commit 2d9c344

Please sign in to comment.