mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
MDL-74434 block_tag_youtube: Update instances only if category is set
Modifies the existing upgrade step to only take into consideration block instances that have a specific category set prior to determening if a legacy category is being used and updating them. Instances that do not have any category set should be ignored.
This commit is contained in:
parent
ad6dc71c56
commit
32754bdf2a
@ -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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user