From a5fafcd922c85d64972d1a5844ad8ae9a65314d5 Mon Sep 17 00:00:00 2001
From: "omkar.podey" <omkar.podey@3685158.no-reply.drupal.org>
Date: Mon, 29 Aug 2022 14:30:05 +0000
Subject: [PATCH] Issue #3305994 by omkar.podey: We don't want to run the
 XdebugValidator for non-Automatic Updates stage

---
 src/Validator/XdebugValidator.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/Validator/XdebugValidator.php b/src/Validator/XdebugValidator.php
index b9237e1ed5..07388237e5 100644
--- a/src/Validator/XdebugValidator.php
+++ b/src/Validator/XdebugValidator.php
@@ -4,6 +4,7 @@ namespace Drupal\automatic_updates\Validator;
 
 use Drupal\automatic_updates\CronUpdater;
 use Drupal\automatic_updates\Event\ReadinessCheckEvent;
+use Drupal\automatic_updates\Updater;
 use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\package_manager\Event\PreCreateEvent;
 use Drupal\package_manager\Event\PreOperationStageEvent;
@@ -28,6 +29,11 @@ final class XdebugValidator implements EventSubscriberInterface {
    *   The event object.
    */
   public function checkForXdebug(PreOperationStageEvent $event): void {
+    // We only want to do this check if the stage belongs to Automatic Updates.
+    if (!($event->getStage() instanceof Updater)) {
+      return;
+    }
+
     if (function_exists('xdebug_break')) {
       $messages = [
         $this->t('Xdebug is enabled, which may cause timeout errors.'),
-- 
GitLab