diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 574bcf38197..726c201a892 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -3651,6 +3651,8 @@ privatefiles,moodle|/user/files.php'; // Save locked. if ($locked) { set_config($provider.'_provider_'.$prefname.'_locked', 1, 'message'); + } else { + set_config($provider.'_provider_'.$prefname.'_locked', 0, 'message'); } // Remove old value. unset_config($provider.'_provider_'.$prefname.'_permitted', 'message'); @@ -4107,5 +4109,26 @@ privatefiles,moodle|/user/files.php'; upgrade_main_savepoint(true, 2022021100.02); } + if ($oldversion < 2022022600.01) { + // Get all processor and existing preferences. + $processors = $DB->get_records('message_processors'); + $providers = $DB->get_records('message_providers', null, '', 'id, name, component'); + $existingpreferences = get_config('message'); + + foreach ($processors as $processor) { + foreach ($providers as $provider) { + // Setting default preference name. + $componentproviderbase = $provider->component . '_' . $provider->name; + $preferencename = $processor->name.'_provider_'.$componentproviderbase.'_locked'; + // If we do not have this setting yet, set it to 0. + if (!isset($existingpreferences->{$preferencename})) { + set_config($preferencename, 0, 'message'); + } + } + } + + upgrade_main_savepoint(true, 2022022600.01); + } + return true; } diff --git a/version.php b/version.php index fd12ff7702a..acd4236b707 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2022022600.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2022022600.01; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '4.0dev+ (Build: 20220226)'; // Human-friendly version name