Skip to content
Snippets Groups Projects

Issue #3232004: Move path computation into a Locator service

Merged Issue #3232004: Move path computation into a Locator service
All threads resolved!
All threads resolved!
Files
8
@@ -5,7 +5,7 @@ namespace Drupal\automatic_updates\Validator;
@@ -5,7 +5,7 @@ namespace Drupal\automatic_updates\Validator;
use Drupal\automatic_updates\AutomaticUpdatesEvents;
use Drupal\automatic_updates\AutomaticUpdatesEvents;
use Drupal\automatic_updates\Event\UpdateEvent;
use Drupal\automatic_updates\Event\UpdateEvent;
use Drupal\automatic_updates\Exception\UpdateException;
use Drupal\automatic_updates\Exception\UpdateException;
use Drupal\automatic_updates\Updater;
use Drupal\automatic_updates\PathLocator;
use Drupal\automatic_updates\Validation\ValidationResult;
use Drupal\automatic_updates\Validation\ValidationResult;
use Drupal\Component\Serialization\Json;
use Drupal\Component\Serialization\Json;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\StringTranslationTrait;
@@ -20,23 +20,23 @@ final class StagedProjectsValidator implements EventSubscriberInterface {
@@ -20,23 +20,23 @@ final class StagedProjectsValidator implements EventSubscriberInterface {
use StringTranslationTrait;
use StringTranslationTrait;
/**
/**
* The updater service.
* The path locator service.
*
*
* @var \Drupal\automatic_updates\Updater
* @var \Drupal\automatic_updates\PathLocator
*/
*/
protected $updater;
protected $pathLocator;
/**
/**
* Constructs a StagedProjectsValidation object.
* Constructs a StagedProjectsValidation object.
*
*
* @param \Drupal\Core\StringTranslation\TranslationInterface $translation
* @param \Drupal\Core\StringTranslation\TranslationInterface $translation
* The translation service.
* The translation service.
* @param \Drupal\automatic_updates\Updater $updater
* @param \Drupal\automatic_updates\PathLocator $path_locator
* The updater service.
* The path locator service.
*/
*/
public function __construct(TranslationInterface $translation, Updater $updater) {
public function __construct(TranslationInterface $translation, PathLocator $path_locator) {
$this->setStringTranslation($translation);
$this->setStringTranslation($translation);
$this->updater = $updater;
$this->pathLocator = $path_locator;
}
}
/**
/**
@@ -87,8 +87,8 @@ final class StagedProjectsValidator implements EventSubscriberInterface {
@@ -87,8 +87,8 @@ final class StagedProjectsValidator implements EventSubscriberInterface {
*/
*/
public function validateStagedProjects(UpdateEvent $event): void {
public function validateStagedProjects(UpdateEvent $event): void {
try {
try {
$active_packages = $this->getDrupalPackagesFromLockFile($this->updater->getActiveDirectory() . "/composer.lock");
$active_packages = $this->getDrupalPackagesFromLockFile($this->pathLocator->getActiveDirectory() . "/composer.lock");
$staged_packages = $this->getDrupalPackagesFromLockFile($this->updater->getStageDirectory() . "/composer.lock");
$staged_packages = $this->getDrupalPackagesFromLockFile($this->pathLocator->getStageDirectory() . "/composer.lock");
}
}
catch (UpdateException $e) {
catch (UpdateException $e) {
foreach ($e->getValidationResults() as $result) {
foreach ($e->getValidationResults() as $result) {
Loading