Skip to content
Snippets Groups Projects
Commit 4cad03f9 authored by Yash Rode's avatar Yash Rode Committed by Ted Bowman
Browse files

Issue #3305998 by yash.rode, tedbow: Ensure AutoUpdate validator only apply...

Issue #3305998 by yash.rode, tedbow: Ensure AutoUpdate validator only apply where the stage is an Updater instance
parent b5d4cb06
No related branches found
No related tags found
No related merge requests found
...@@ -119,6 +119,10 @@ class CronFrequencyValidator implements EventSubscriberInterface { ...@@ -119,6 +119,10 @@ class CronFrequencyValidator implements EventSubscriberInterface {
* The event object. * The event object.
*/ */
public function checkCronFrequency(ReadinessCheckEvent $event): void { public function checkCronFrequency(ReadinessCheckEvent $event): void {
// We only want to do this check if the stage belongs to Automatic Updates.
if (!$event->getStage() instanceof CronUpdater) {
return;
}
// If automatic updates are disabled during cron, there's nothing we need // If automatic updates are disabled during cron, there's nothing we need
// to validate. // to validate.
if ($this->cronUpdater->getMode() === CronUpdater::DISABLED) { if ($this->cronUpdater->getMode() === CronUpdater::DISABLED) {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Drupal\automatic_updates\Validator; namespace Drupal\automatic_updates\Validator;
use Drupal\automatic_updates\Event\ReadinessCheckEvent; use Drupal\automatic_updates\Event\ReadinessCheckEvent;
use Drupal\automatic_updates\Updater;
use Drupal\package_manager\Validator\PreOperationStageValidatorInterface; use Drupal\package_manager\Validator\PreOperationStageValidatorInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
...@@ -44,6 +45,10 @@ final class PackageManagerReadinessCheck implements EventSubscriberInterface { ...@@ -44,6 +45,10 @@ final class PackageManagerReadinessCheck implements EventSubscriberInterface {
* The event object. * The event object.
*/ */
public function validate(ReadinessCheckEvent $event): void { public function validate(ReadinessCheckEvent $event): void {
// We only want to do this check if the stage belongs to Automatic Updates.
if (!$event->getStage() instanceof Updater) {
return;
}
$this->validator->validateStagePreOperation($event); $this->validator->validateStagePreOperation($event);
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Drupal\automatic_updates\Validator; namespace Drupal\automatic_updates\Validator;
use Drupal\automatic_updates\Event\ReadinessCheckEvent; use Drupal\automatic_updates\Event\ReadinessCheckEvent;
use Drupal\automatic_updates\Updater;
use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\package_manager\ComposerUtility; use Drupal\package_manager\ComposerUtility;
use Drupal\package_manager\Event\PreApplyEvent; use Drupal\package_manager\Event\PreApplyEvent;
...@@ -44,6 +45,10 @@ final class ScaffoldFilePermissionsValidator implements PreOperationStageValidat ...@@ -44,6 +45,10 @@ final class ScaffoldFilePermissionsValidator implements PreOperationStageValidat
* {@inheritdoc} * {@inheritdoc}
*/ */
public function validateStagePreOperation(PreOperationStageEvent $event): void { public function validateStagePreOperation(PreOperationStageEvent $event): void {
// We only want to do this check if the stage belongs to Automatic Updates.
if (!$event->getStage() instanceof Updater) {
return;
}
$paths = []; $paths = [];
// Figure out the absolute path of `sites/default`. // Figure out the absolute path of `sites/default`.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment