Skip to content
Snippets Groups Projects
Commit d55c360c authored by Adam G-H's avatar Adam G-H
Browse files

Issue #3245376 by phenaproxima, tedbow: Move the path locator entirely to Package Manager

parent ade675e8
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@ services:
arguments:
- '@keyvalue.expirable'
- '@datetime.time'
- '@automatic_updates.path_locator'
- '@package_manager.path_locator'
- '@event_dispatcher'
- 24
automatic_updates.updater:
......@@ -46,7 +46,7 @@ services:
automatic_updates.disk_space_validator:
class: Drupal\automatic_updates\Validator\DiskSpaceValidator
arguments:
- '@automatic_updates.path_locator'
- '@package_manager.path_locator'
- '@string_translation'
tags:
- { name: event_subscriber }
......@@ -61,7 +61,7 @@ services:
automatic_updates.validator.file_system_permissions:
class: Drupal\automatic_updates\Validator\WritableFileSystemValidator
arguments:
- '@automatic_updates.path_locator'
- '@package_manager.path_locator'
- '%app.root%'
- '@string_translation'
tags:
......@@ -70,8 +70,3 @@ services:
class: Drupal\automatic_updates\Validator\CoreComposerValidator
tags:
- { name: event_subscriber }
automatic_updates.path_locator:
class: Drupal\automatic_updates\PathLocator
arguments:
- '@config.factory'
- '%app.root%'
<?php
namespace Drupal\automatic_updates;
use Drupal\package_manager\PathLocator as PackageManagerPathLocator;
/**
* Computes file system paths that are needed for automatic updates.
*/
class PathLocator extends PackageManagerPathLocator {
}
......@@ -4,11 +4,11 @@ namespace Drupal\automatic_updates\Validation;
use Drupal\automatic_updates\AutomaticUpdatesEvents;
use Drupal\automatic_updates\Event\ReadinessCheckEvent;
use Drupal\automatic_updates\PathLocator;
use Drupal\automatic_updates\UpdateRecommender;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface;
use Drupal\package_manager\ComposerUtility;
use Drupal\package_manager\PathLocator;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
......@@ -47,7 +47,7 @@ class ReadinessValidationManager {
/**
* The path locator service.
*
* @var \Drupal\automatic_updates\PathLocator
* @var \Drupal\package_manager\PathLocator
*/
protected $pathLocator;
......@@ -58,7 +58,7 @@ class ReadinessValidationManager {
* The key/value expirable factory.
* @param \Drupal\Component\Datetime\TimeInterface $time
* The time service.
* @param \Drupal\automatic_updates\PathLocator $path_locator
* @param \Drupal\package_manager\PathLocator $path_locator
* The path locator service.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
* The event dispatcher service.
......
......@@ -4,12 +4,12 @@ namespace Drupal\automatic_updates\Validator;
use Drupal\automatic_updates\AutomaticUpdatesEvents;
use Drupal\automatic_updates\Event\UpdateEvent;
use Drupal\automatic_updates\PathLocator;
use Drupal\automatic_updates\Validation\ValidationResult;
use Drupal\Component\FileSystem\FileSystem;
use Drupal\Component\Utility\Bytes;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\package_manager\PathLocator;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
......@@ -22,14 +22,14 @@ class DiskSpaceValidator implements EventSubscriberInterface {
/**
* The path locator service.
*
* @var \Drupal\automatic_updates\PathLocator
* @var \Drupal\package_manager\PathLocator
*/
protected $pathLocator;
/**
* Constructs a DiskSpaceValidator object.
*
* @param \Drupal\automatic_updates\PathLocator $path_locator
* @param \Drupal\package_manager\PathLocator $path_locator
* The path locator service.
* @param \Drupal\Core\StringTranslation\TranslationInterface $translation
* The translation service.
......
......@@ -4,10 +4,10 @@ namespace Drupal\automatic_updates\Validator;
use Drupal\automatic_updates\AutomaticUpdatesEvents;
use Drupal\automatic_updates\Event\UpdateEvent;
use Drupal\automatic_updates\PathLocator;
use Drupal\automatic_updates\Validation\ValidationResult;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\package_manager\PathLocator;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
......@@ -20,7 +20,7 @@ class WritableFileSystemValidator implements EventSubscriberInterface {
/**
* The path locator service.
*
* @var \Drupal\automatic_updates\PathLocator
* @var \Drupal\package_manager\PathLocator
*/
protected $pathLocator;
......@@ -34,7 +34,7 @@ class WritableFileSystemValidator implements EventSubscriberInterface {
/**
* Constructs a WritableFileSystemValidator object.
*
* @param \Drupal\automatic_updates\PathLocator $path_locator
* @param \Drupal\package_manager\PathLocator $path_locator
* The path locator service.
* @param string $app_root
* The Drupal root.
......
......@@ -49,7 +49,7 @@ class FileSystemOperationsTest extends AutomaticUpdatesFunctionalTestBase {
// active directory, and has a staging area within the site directory for
// this test.
$drupal_root = $this->getDrupalRoot();
/** @var \Drupal\automatic_updates\PathLocator|\Prophecy\Prophecy\ObjectProphecy $locator */
/** @var \Drupal\package_manager\PathLocator|\Prophecy\Prophecy\ObjectProphecy $locator */
$locator = $this->prophesize(PathLocator::class);
$locator->getActiveDirectory()->willReturn(__DIR__ . '/../../fixtures/fake-site');
$this->stageDir = implode(DIRECTORY_SEPARATOR, [
......
......@@ -2,9 +2,9 @@
namespace Drupal\Tests\automatic_updates\Kernel\ReadinessValidation;
use Drupal\automatic_updates\PathLocator;
use Drupal\automatic_updates\Validation\ValidationResult;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\package_manager\PathLocator;
use Drupal\Tests\automatic_updates\Kernel\AutomaticUpdatesKernelTestBase;
/**
......@@ -38,7 +38,7 @@ class CoreComposerValidatorTest extends AutomaticUpdatesKernelTestBase {
// Point to a valid composer.json with no requirements.
$locator = $this->prophesize(PathLocator::class);
$locator->getActiveDirectory()->willReturn(__DIR__ . '/../../../fixtures/project_staged_validation/no_core_requirements');
$this->container->set('automatic_updates.path_locator', $locator->reveal());
$this->container->set('package_manager.path_locator', $locator->reveal());
$error = ValidationResult::createError([
'Drupal core does not appear to be required in the project-level composer.json.',
......
......@@ -151,7 +151,7 @@ class DiskSpaceValidatorTest extends AutomaticUpdatesKernelTestBase {
* @dataProvider providerDiskSpaceValidation
*/
public function testDiskSpaceValidation(bool $shared_disk, array $free_space, array $expected_results): void {
$path_locator = $this->prophesize('\Drupal\automatic_updates\PathLocator');
$path_locator = $this->prophesize('\Drupal\package_manager\PathLocator');
$path_locator->getProjectRoot()->willReturn('root');
$path_locator->getVendorDirectory()->willReturn('vendor');
......
......@@ -2,10 +2,10 @@
namespace Drupal\Tests\automatic_updates\Kernel\ReadinessValidation;
use Drupal\automatic_updates\PathLocator;
use Drupal\automatic_updates\Validation\ValidationResult;
use Drupal\automatic_updates\Validator\WritableFileSystemValidator;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\package_manager\PathLocator;
use Drupal\Tests\automatic_updates\Kernel\AutomaticUpdatesKernelTestBase;
use org\bovigo\vfs\vfsStream;
......
......@@ -2,7 +2,7 @@
namespace Drupal\Tests\automatic_updates\Kernel;
use Drupal\automatic_updates\PathLocator;
use Drupal\package_manager\PathLocator;
/**
* @coversDefaultClass \Drupal\automatic_updates\Updater
......
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