Skip to content
Snippets Groups Projects

Issue #3365177: RequestedUpdateValidator should subscribe to StatusCheck

Merged Issue #3365177: RequestedUpdateValidator should subscribe to StatusCheck
1 unresolved thread
1 unresolved thread
Files
4
@@ -9,6 +9,7 @@ use Drupal\automatic_updates\UpdateStage;
@@ -9,6 +9,7 @@ use Drupal\automatic_updates\UpdateStage;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\package_manager\ComposerInspector;
use Drupal\package_manager\ComposerInspector;
use Drupal\package_manager\Event\PreApplyEvent;
use Drupal\package_manager\Event\PreApplyEvent;
 
use Drupal\package_manager\Event\StatusCheckEvent;
use Drupal\package_manager\PathLocator;
use Drupal\package_manager\PathLocator;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -40,12 +41,12 @@ final class RequestedUpdateValidator implements EventSubscriberInterface {
@@ -40,12 +41,12 @@ final class RequestedUpdateValidator implements EventSubscriberInterface {
/**
/**
* Validates that requested packages have been updated to the right version.
* Validates that requested packages have been updated to the right version.
*
*
* @param \Drupal\package_manager\Event\PreApplyEvent $event
* @param \Drupal\package_manager\Event\PreApplyEvent|\Drupal\package_manager\Event\StatusCheckEvent $event
* The pre-apply event.
* The pre-apply event.
*/
*/
public function checkRequestedStagedVersion(PreApplyEvent $event): void {
public function checkRequestedStagedVersion(PreApplyEvent|StatusCheckEvent $event): void {
$stage = $event->stage;
$stage = $event->stage;
if (!($stage instanceof UpdateStage)) {
if (!($stage instanceof UpdateStage) || !$stage->stageDirectoryExists()) {
return;
return;
}
}
$requested_package_versions = $stage->getPackageVersions();
$requested_package_versions = $stage->getPackageVersions();
@@ -96,6 +97,7 @@ final class RequestedUpdateValidator implements EventSubscriberInterface {
@@ -96,6 +97,7 @@ final class RequestedUpdateValidator implements EventSubscriberInterface {
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public static function getSubscribedEvents(): array {
public static function getSubscribedEvents(): array {
 
$events[StatusCheckEvent::class][] = ['checkRequestedStagedVersion'];
$events[PreApplyEvent::class][] = ['checkRequestedStagedVersion'];
$events[PreApplyEvent::class][] = ['checkRequestedStagedVersion'];
return $events;
return $events;
}
}
Loading