Skip to content
Snippets Groups Projects
Commit 560d2f9a authored by Ted Bowman's avatar Ted Bowman Committed by Adam G-H
Browse files

Issue #3258661 by tedbow, phenaproxima: use...

Issue #3258661 by tedbow, phenaproxima: use \Drupal\package_manager\Stage::getActiveComposer() instead of path locator service to get active composer where possible
parent 6a33f3c6
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,6 @@ services: ...@@ -4,7 +4,6 @@ services:
arguments: arguments:
- '@keyvalue.expirable' - '@keyvalue.expirable'
- '@datetime.time' - '@datetime.time'
- '@package_manager.path_locator'
- '@event_dispatcher' - '@event_dispatcher'
- '@automatic_updates.updater' - '@automatic_updates.updater'
- 24 - 24
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
namespace Drupal\automatic_updates; namespace Drupal\automatic_updates;
use Drupal\automatic_updates\Exception\UpdateException; use Drupal\automatic_updates\Exception\UpdateException;
use Drupal\package_manager\ComposerUtility;
use Drupal\package_manager\Event\StageEvent; use Drupal\package_manager\Event\StageEvent;
use Drupal\package_manager\Exception\StageValidationException; use Drupal\package_manager\Exception\StageValidationException;
use Drupal\package_manager\Stage; use Drupal\package_manager\Stage;
...@@ -30,7 +29,7 @@ class Updater extends Stage { ...@@ -30,7 +29,7 @@ class Updater extends Stage {
throw new \InvalidArgumentException("Currently only updates to Drupal core are supported."); throw new \InvalidArgumentException("Currently only updates to Drupal core are supported.");
} }
$composer = ComposerUtility::createForDirectory($this->pathLocator->getProjectRoot()); $composer = $this->getActiveComposer();
$package_versions = [ $package_versions = [
'production' => [], 'production' => [],
'dev' => [], 'dev' => [],
......
...@@ -7,8 +7,6 @@ use Drupal\automatic_updates\Updater; ...@@ -7,8 +7,6 @@ use Drupal\automatic_updates\Updater;
use Drupal\automatic_updates\UpdateRecommender; use Drupal\automatic_updates\UpdateRecommender;
use Drupal\Component\Datetime\TimeInterface; use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface; use Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface;
use Drupal\package_manager\ComposerUtility;
use Drupal\package_manager\PathLocator;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/** /**
...@@ -44,12 +42,6 @@ class ReadinessValidationManager { ...@@ -44,12 +42,6 @@ class ReadinessValidationManager {
*/ */
protected $resultsTimeToLive; protected $resultsTimeToLive;
/**
* The path locator service.
*
* @var \Drupal\package_manager\PathLocator
*/
protected $pathLocator;
/** /**
* The updater service. * The updater service.
...@@ -65,8 +57,6 @@ class ReadinessValidationManager { ...@@ -65,8 +57,6 @@ class ReadinessValidationManager {
* The key/value expirable factory. * The key/value expirable factory.
* @param \Drupal\Component\Datetime\TimeInterface $time * @param \Drupal\Component\Datetime\TimeInterface $time
* The time service. * The time service.
* @param \Drupal\package_manager\PathLocator $path_locator
* The path locator service.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
* The event dispatcher service. * The event dispatcher service.
* @param \Drupal\automatic_updates\Updater $updater * @param \Drupal\automatic_updates\Updater $updater
...@@ -74,10 +64,9 @@ class ReadinessValidationManager { ...@@ -74,10 +64,9 @@ class ReadinessValidationManager {
* @param int $results_time_to_live * @param int $results_time_to_live
* The number of hours to store results. * The number of hours to store results.
*/ */
public function __construct(KeyValueExpirableFactoryInterface $key_value_expirable_factory, TimeInterface $time, PathLocator $path_locator, EventDispatcherInterface $dispatcher, Updater $updater, int $results_time_to_live) { public function __construct(KeyValueExpirableFactoryInterface $key_value_expirable_factory, TimeInterface $time, EventDispatcherInterface $dispatcher, Updater $updater, int $results_time_to_live) {
$this->keyValueExpirable = $key_value_expirable_factory->get('automatic_updates'); $this->keyValueExpirable = $key_value_expirable_factory->get('automatic_updates');
$this->time = $time; $this->time = $time;
$this->pathLocator = $path_locator;
$this->eventDispatcher = $dispatcher; $this->eventDispatcher = $dispatcher;
$this->updater = $updater; $this->updater = $updater;
$this->resultsTimeToLive = $results_time_to_live; $this->resultsTimeToLive = $results_time_to_live;
...@@ -89,7 +78,7 @@ class ReadinessValidationManager { ...@@ -89,7 +78,7 @@ class ReadinessValidationManager {
* @return $this * @return $this
*/ */
public function run(): self { public function run(): self {
$composer = ComposerUtility::createForDirectory($this->pathLocator->getProjectRoot()); $composer = $this->updater->getActiveComposer();
$recommender = new UpdateRecommender(); $recommender = new UpdateRecommender();
$release = $recommender->getRecommendedRelease(TRUE); $release = $recommender->getRecommendedRelease(TRUE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment