Skip to content
Snippets Groups Projects

Issue #3293422: Don't allow cron updates if Xdebug is enabled

Merged Issue #3293422: Don't allow cron updates if Xdebug is enabled
All threads resolved!
All threads resolved!
Files
2
@@ -2,8 +2,11 @@
namespace Drupal\automatic_updates\Validator;
use Drupal\automatic_updates\CronUpdater;
use Drupal\automatic_updates\Event\ReadinessCheckEvent;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\package_manager\Event\PreCreateEvent;
use Drupal\package_manager\Event\PreOperationStageEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
@@ -21,14 +24,21 @@ final class XdebugValidator implements EventSubscriberInterface {
/**
* Flags a warning if Xdebug is enabled.
*
* @param \Drupal\automatic_updates\Event\ReadinessCheckEvent $event
* @param \Drupal\package_manager\Event\PreOperationStageEvent $event
* The event object.
*/
public function checkForXdebug(ReadinessCheckEvent $event): void {
if (extension_loaded('xdebug')) {
$event->addWarning([
public function checkForXdebug(PreOperationStageEvent $event): void {
+1
if (function_exists('xdebug_break')) {
$messages = [
$this->t('Xdebug is enabled, which may cause timeout errors.'),
]);
];
if ($event->getStage() instanceof CronUpdater && $event instanceof PreCreateEvent) {
$event->addError($messages);
}
else {
$event->addWarning($messages);
}
}
}
@@ -38,6 +48,7 @@ final class XdebugValidator implements EventSubscriberInterface {
public static function getSubscribedEvents() {
return [
ReadinessCheckEvent::class => 'checkForXdebug',
PreCreateEvent::class => 'checkForXdebug',
];
}
Loading