MDL-83692 factor_sms: MFA update default values when fields are unset
This commit is contained in:
@@ -76,5 +76,19 @@ function xmldb_factor_sms_upgrade(int $oldversion): bool {
|
||||
// Automatically generated Moodle v4.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2025040100) {
|
||||
// Ensure default values are applied for the MFA SMS factor when upgrading.
|
||||
$config = get_config('factor_sms');
|
||||
if ((int)$config->weight === 0) {
|
||||
set_config('weight', 100, 'factor_sms');
|
||||
}
|
||||
if ((int)$config->duration === 0) {
|
||||
set_config('duration', 30 * MINSECS, 'factor_sms');
|
||||
}
|
||||
|
||||
// MFA savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2025040100, 'factor', 'sms');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2024100700; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2025040100; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2024100100; // Requires this Moodle version.
|
||||
$plugin->component = 'factor_sms'; // Full name of the plugin (used for diagnostics).
|
||||
$plugin->maturity = MATURITY_STABLE;
|
||||
|
||||
Reference in New Issue
Block a user