diff --git a/src/Validator/CronFrequencyValidator.php b/src/Validator/CronFrequencyValidator.php index d3c34655733faf20d6a7441d13af926dafc3e356..b7e545ffcec3ead4e225322bfec470fc7e70e077 100644 --- a/src/Validator/CronFrequencyValidator.php +++ b/src/Validator/CronFrequencyValidator.php @@ -119,6 +119,10 @@ class CronFrequencyValidator implements EventSubscriberInterface { * The event object. */ 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 // to validate. if ($this->cronUpdater->getMode() === CronUpdater::DISABLED) { diff --git a/src/Validator/PackageManagerReadinessCheck.php b/src/Validator/PackageManagerReadinessCheck.php index c26f05cd6b2f5dd485bef51c104cdb6bee9d3342..e562b6cea4d4552dc689a23907202c76a294ecb7 100644 --- a/src/Validator/PackageManagerReadinessCheck.php +++ b/src/Validator/PackageManagerReadinessCheck.php @@ -3,6 +3,7 @@ namespace Drupal\automatic_updates\Validator; use Drupal\automatic_updates\Event\ReadinessCheckEvent; +use Drupal\automatic_updates\Updater; use Drupal\package_manager\Validator\PreOperationStageValidatorInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -44,6 +45,10 @@ final class PackageManagerReadinessCheck implements EventSubscriberInterface { * The event object. */ 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); } diff --git a/src/Validator/ScaffoldFilePermissionsValidator.php b/src/Validator/ScaffoldFilePermissionsValidator.php index 681ca0c2ef8437fcf43474bf20cc9fb386fa78fe..078a6cf01fa7175a0a2046b8af9c6009597bda20 100644 --- a/src/Validator/ScaffoldFilePermissionsValidator.php +++ b/src/Validator/ScaffoldFilePermissionsValidator.php @@ -3,6 +3,7 @@ namespace Drupal\automatic_updates\Validator; use Drupal\automatic_updates\Event\ReadinessCheckEvent; +use Drupal\automatic_updates\Updater; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\package_manager\ComposerUtility; use Drupal\package_manager\Event\PreApplyEvent; @@ -44,6 +45,10 @@ final class ScaffoldFilePermissionsValidator implements PreOperationStageValidat * {@inheritdoc} */ 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 = []; // Figure out the absolute path of `sites/default`.