diff --git a/core/modules/update/config/schema/update.schema.yml b/core/modules/update/config/schema/update.schema.yml index 06eeb49c367..9344316517b 100644 --- a/core/modules/update/config/schema/update.schema.yml +++ b/core/modules/update/config/schema/update.schema.yml @@ -3,6 +3,8 @@ update.settings: type: config_object label: 'Update settings' + constraints: + FullyValidatable: ~ mapping: check: type: mapping @@ -14,6 +16,10 @@ update.settings: interval_days: type: integer label: 'Days since last check' + constraints: + # @see \Drupal\update\UpdateSettingsForm::buildForm() + # The options are daily and weekly. + Choice: [1, 7] fetch: type: mapping label: 'Fetch settings' @@ -25,9 +31,15 @@ update.settings: max_attempts: type: integer label: 'Maximum attempts' + constraints: + Range: + min: 1 timeout: type: integer label: 'Timeout in seconds' + constraints: + Range: + min: 1 notification: type: mapping label: 'Notification settings' @@ -41,3 +53,6 @@ update.settings: threshold: type: string label: 'Email notification threshold' + constraints: + # @see \Drupal\update\UpdateSettingsForm::buildForm() + Choice: [all, security] diff --git a/core/modules/update/migrations/update_settings.yml b/core/modules/update/migrations/update_settings.yml index 6525a30e33e..bd93b7033ef 100644 --- a/core/modules/update/migrations/update_settings.yml +++ b/core/modules/update/migrations/update_settings.yml @@ -19,6 +19,12 @@ process: 'notification/threshold': update_notification_threshold 'notification/emails': update_notify_emails 'check/interval_days': update_check_frequency + 'check/disabled_extensions': + plugin: default_value + default_value: false + 'fetch/timeout': + plugin: default_value + default_value: 30 destination: plugin: config config_name: update.settings diff --git a/core/modules/update/src/UpdateSettingsForm.php b/core/modules/update/src/UpdateSettingsForm.php index 6f4628317e8..d519831248c 100644 --- a/core/modules/update/src/UpdateSettingsForm.php +++ b/core/modules/update/src/UpdateSettingsForm.php @@ -36,10 +36,13 @@ class UpdateSettingsForm extends ConfigFormBase { $form['update_check_frequency'] = [ '#type' => 'radios', '#title' => $this->t('Check for updates'), - '#config_target' => 'update.settings:check.interval_days', + '#config_target' => new ConfigTarget( + 'update.settings', + 'check.interval_days', + toConfig: fn($value) => intval($value)), '#options' => [ - '1' => $this->t('Daily'), - '7' => $this->t('Weekly'), + 1 => $this->t('Daily'), + 7 => $this->t('Weekly'), ], '#description' => $this->t('Select how frequently you want to automatically check for new releases of your currently installed modules and themes.'), ];