Skip to content
Snippets Groups Projects

Issue #3377237: For now, disallow unattended updates on Windows machines

Merged Issue #3377237: For now, disallow unattended updates on Windows machines
All threads resolved!
All threads resolved!
2 files
+ 169
13
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -49,22 +49,26 @@ final class WindowsValidator implements EventSubscriberInterface {
* The event being handled.
*/
public function validate(PreOperationStageEvent $event): void {
$stage = $event->stage;
if ($stage instanceof CronUpdateStage && $stage->getMode() !== CronUpdateStage::DISABLED) {
$method = $this->configFactory->get('automatic_updates.settings')
->get('unattended.method');
// If we're not on Windows, there's nothing for us to validate.
if ($this->host::isWindows() === FALSE) {
return;
}
if ($method === 'web' && $this->host::isWindows()) {
$message = $this->t('Unattended updates are not supported on Windows.');
$method = $this->configFactory->get('automatic_updates.settings')
->get('unattended.method');
$stage = $event->stage;
if ($stage instanceof CronUpdateStage && $stage->getMode() !== CronUpdateStage::DISABLED && $method === 'web') {
$message = $this->t('Unattended updates are not supported on Windows.');
$form_url = Url::fromRoute('update.report_update');
if ($form_url->access()) {
$message = $this->t('@message Use <a href=":form-url">the update form</a> to update Drupal core.', [
':form-url' => $form_url->toString(),
]);
}
$event->addError([$message]);
$form_url = Url::fromRoute('update.report_update');
if ($form_url->access()) {
$message = $this->t('@message Use <a href=":form-url">the update form</a> to update Drupal core.', [
'@message' => $message,
':form-url' => $form_url->toString(),
]);
}
$event->addError([$message]);
}
}
Loading