Merge branch 'MDL-74434-master' of https://github.com/mihailges/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2022-04-07 17:12:08 +02:00
commit bdf12da661

View File

@ -101,6 +101,12 @@ function xmldb_block_tag_youtube_upgrade($oldversion) {
// If the block uses a legacy category name, update it to use the current category ID instead.
foreach ($blockinstances as $blockinstance) {
$blockconfig = unserialize(base64_decode($blockinstance->configdata));
// Skip if the block does not have a specific category set.
if (!isset($blockconfig->category)) {
continue;
}
$blockcategoryconfig = $blockconfig->category;
// The block is using a legacy category name as a category config.
if (array_key_exists($blockcategoryconfig, $categorynamemap)) {