Skip to content
Snippets Groups Projects
Commit f629a418 authored by Wim Leers's avatar Wim Leers Committed by Adam G-H
Browse files

Issue #3348122 by yash.rode, Wim Leers, phenaproxima: Autowire everything...

Issue #3348122 by yash.rode, Wim Leers, phenaproxima: Autowire everything everywhere all at once … in *.services.yml files
parent b6fcdb42
No related branches found
No related tags found
No related merge requests found
......@@ -9,57 +9,22 @@ services:
automatic_updates.status_checker:
class: Drupal\automatic_updates\Validation\StatusChecker
arguments:
- '@keyvalue.expirable'
- '@datetime.time'
- '@event_dispatcher'
- '@automatic_updates.updater'
- '@automatic_updates.cron_updater'
- 24
# @todo Remove this when https://drupal.org/i/3325557 lands.
$key_value_expirable_factory: '@keyvalue.expirable'
$resultsTimeToLive: 24
tags:
- { name: event_subscriber }
Drupal\automatic_updates\Validation\StatusChecker: '@automatic_updates.status_checker'
automatic_updates.status_check_mailer:
class: Drupal\automatic_updates\StatusCheckMailer
arguments:
- '@config.factory'
- '@plugin.manager.mail'
- '@language_manager'
Drupal\automatic_updates\StatusCheckMailer: '@automatic_updates.status_check_mailer'
automatic_updates.updater:
class: Drupal\automatic_updates\Updater
arguments:
- '@package_manager.composer_inspector'
- '@package_manager.path_locator'
- '@package_manager.beginner'
- '@package_manager.stager'
- '@package_manager.committer'
- '@file_system'
- '@event_dispatcher'
- '@tempstore.shared'
- '@datetime.time'
- '@PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface'
- '@package_manager.failure_marker'
calls:
- ['setLogger', ['@logger.channel.automatic_updates']]
Drupal\automatic_updates\Updater: '@automatic_updates.updater'
automatic_updates.cron_updater:
class: Drupal\automatic_updates\CronUpdater
arguments:
- '@automatic_updates.release_chooser'
- '@plugin.manager.mail'
- '@automatic_updates.status_check_mailer'
- '@state'
- '@config.factory'
- '@package_manager.composer_inspector'
- '@package_manager.path_locator'
- '@package_manager.beginner'
- '@package_manager.stager'
- '@package_manager.committer'
- '@file_system'
- '@event_dispatcher'
- '@tempstore.shared'
- '@datetime.time'
- '@PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface'
- '@package_manager.failure_marker'
calls:
- ['setLogger', ['@logger.channel.automatic_updates']]
Drupal\automatic_updates\CronUpdater: '@automatic_updates.cron_updater'
......@@ -69,9 +34,6 @@ services:
- { name: event_subscriber }
automatic_updates.staged_projects_validator:
class: Drupal\automatic_updates\Validator\StagedProjectsValidator
arguments:
- '@package_manager.path_locator'
- '@package_manager.composer_inspector'
tags:
- { name: event_subscriber }
Drupal\automatic_updates\Validator\StagedProjectsValidator: '@automatic_updates.staged_projects_validator'
......@@ -83,29 +45,20 @@ services:
automatic_updates.cron_frequency_validator:
class: Drupal\automatic_updates\Validator\CronFrequencyValidator
arguments:
- '@config.factory'
- '@module_handler'
- '@state'
- '@datetime.time'
- '@automatic_updates.cron_updater'
- '@lock'
$lock: '@lock'
tags:
- { name: event_subscriber }
automatic_updates.validator.staged_database_updates:
class: Drupal\automatic_updates\Validator\StagedDatabaseUpdateValidator
arguments:
- '@package_manager.validator.staged_database_updates'
tags:
- { name: event_subscriber }
automatic_updates.validator.version_policy:
class: Drupal\automatic_updates\Validator\VersionPolicyValidator
autowire: true
tags:
- { name: event_subscriber }
Drupal\automatic_updates\Validator\VersionPolicyValidator: '@automatic_updates.validator.version_policy'
automatic_updates.config_subscriber:
class: Drupal\automatic_updates\EventSubscriber\ConfigSubscriber
arguments:
- '@automatic_updates.status_checker'
tags:
- { name: event_subscriber }
automatic_updates.validator.scaffold_file_permissions:
......@@ -115,10 +68,6 @@ services:
Drupal\automatic_updates\Validator\ScaffoldFilePermissionsValidator: '@automatic_updates.validator.scaffold_file_permissions'
automatic_updates.validator.cron_server:
class: Drupal\automatic_updates\Validator\CronServerValidator
arguments:
- '@request_stack'
- '@config.factory'
- '@module_handler'
tags:
- { name: event_subscriber }
logger.channel.automatic_updates:
......
......@@ -4,18 +4,6 @@ services:
automatic_updates_extensions.updater:
class: Drupal\automatic_updates_extensions\ExtensionUpdater
arguments:
- '@package_manager.composer_inspector'
- '@package_manager.path_locator'
- '@package_manager.beginner'
- '@package_manager.stager'
- '@package_manager.committer'
- '@file_system'
- '@event_dispatcher'
- '@tempstore.shared'
- '@datetime.time'
- '@PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface'
- '@package_manager.failure_marker'
Drupal\automatic_updates_extensions\ExtensionUpdater: '@automatic_updates_extensions.updater'
automatic_updates_extensions.validator.target_release:
class: Drupal\automatic_updates_extensions\Validator\UpdateReleaseValidator
......
......@@ -4,10 +4,20 @@ declare(strict_types = 1);
namespace Drupal\automatic_updates_extensions;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\TempStore\SharedTempStoreFactory;
use Drupal\package_manager\ComposerInspector;
use Drupal\package_manager\FailureMarker;
use Drupal\package_manager\LegacyVersionUtility;
use Drupal\package_manager\PathLocator;
use Drupal\package_manager\Stage;
use PhpTuf\ComposerStager\Domain\Core\Beginner\BeginnerInterface;
use PhpTuf\ComposerStager\Domain\Core\Committer\CommitterInterface;
use PhpTuf\ComposerStager\Domain\Core\Stager\StagerInterface;
use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* Defines a service to perform updates for modules and themes.
......@@ -23,11 +33,41 @@ class ExtensionUpdater extends Stage {
*
* @param \Drupal\package_manager\ComposerInspector $composerInspector
* The Composer inspector service.
* @param mixed ...$arguments
* Additional arguments to pass to the parent constructor.
* @param \Drupal\package_manager\PathLocator $pathLocator
* The path locator service.
* @param \PhpTuf\ComposerStager\Domain\Core\Beginner\BeginnerInterface $beginner
* The beginner service.
* @param \PhpTuf\ComposerStager\Domain\Core\Stager\StagerInterface $stager
* The stager service.
* @param \PhpTuf\ComposerStager\Domain\Core\Committer\CommitterInterface $committer
* The committer service.
* @param \Drupal\Core\File\FileSystemInterface $fileSystem
* The file system service.
* @param \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $eventDispatcher
* The event dispatcher service.
* @param \Drupal\Core\TempStore\SharedTempStoreFactory $tempStoreFactory
* The shared tempstore factory.
* @param \Drupal\Component\Datetime\TimeInterface $time
* The time service.
* @param \PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface $pathFactory
* The path factory service.
* @param \Drupal\package_manager\FailureMarker $failureMarker
* The failure marker service.
*/
public function __construct(protected ComposerInspector $composerInspector, mixed ...$arguments) {
parent::__construct(...$arguments);
public function __construct(
protected ComposerInspector $composerInspector,
PathLocator $pathLocator,
BeginnerInterface $beginner,
StagerInterface $stager,
CommitterInterface $committer,
FileSystemInterface $fileSystem,
EventDispatcherInterface $eventDispatcher,
SharedTempStoreFactory $tempStoreFactory,
TimeInterface $time,
PathFactoryInterface $pathFactory,
FailureMarker $failureMarker,
) {
parent::__construct($pathLocator, $beginner, $stager, $committer, $fileSystem, $eventDispatcher, $tempStoreFactory, $time, $pathFactory, $failureMarker);
}
/**
......
......@@ -26,10 +26,13 @@ services:
# Services provided to Drupal by Package Manager.
package_manager.beginner:
class: PhpTuf\ComposerStager\Domain\Core\Beginner\Beginner
PhpTuf\ComposerStager\Domain\Core\Beginner\BeginnerInterface: '@package_manager.beginner'
package_manager.stager:
class: PhpTuf\ComposerStager\Domain\Core\Stager\Stager
PhpTuf\ComposerStager\Domain\Core\Stager\StagerInterface: '@package_manager.stager'
package_manager.committer:
class: PhpTuf\ComposerStager\Domain\Core\Committer\Committer
PhpTuf\ComposerStager\Domain\Core\Committer\CommitterInterface: '@package_manager.committer'
package_manager.path_locator:
class: Drupal\package_manager\PathLocator
arguments:
......@@ -115,6 +118,7 @@ services:
class: Drupal\package_manager\Validator\StagedDBUpdateValidator
tags:
- { name: event_subscriber }
Drupal\package_manager\Validator\StagedDBUpdateValidator: '@package_manager.validator.staged_database_updates'
package_manager.test_site_excluder:
class: Drupal\package_manager\PathExcluder\TestSiteExcluder
tags:
......
......@@ -6,7 +6,7 @@ namespace Drupal\package_manager;
use Drupal\package_manager\Event\CollectIgnoredPathsEvent;
use Drupal\package_manager\Event\StatusCheckEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* Contains helper methods to run status checks on a stage.
......@@ -23,7 +23,7 @@ trait StatusCheckTrait {
*
* @param \Drupal\package_manager\Stage $stage
* The stage to run the status check for.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* @param \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $event_dispatcher
* (optional) The event dispatcher service.
*
* @return \Drupal\package_manager\ValidationResult[]
......
......@@ -4,16 +4,27 @@ declare(strict_types = 1);
namespace Drupal\automatic_updates;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Mail\MailManagerInterface;
use Drupal\Core\State\StateInterface;
use Drupal\Core\TempStore\SharedTempStoreFactory;
use Drupal\Core\Url;
use Drupal\package_manager\ComposerInspector;
use Drupal\package_manager\Exception\ApplyFailedException;
use Drupal\package_manager\Exception\StageEventException;
use Drupal\package_manager\FailureMarker;
use Drupal\package_manager\PathLocator;
use Drupal\package_manager\ProjectInfo;
use Drupal\update\ProjectRelease;
use GuzzleHttp\Psr7\Uri as GuzzleUri;
use PhpTuf\ComposerStager\Domain\Core\Beginner\BeginnerInterface;
use PhpTuf\ComposerStager\Domain\Core\Committer\CommitterInterface;
use PhpTuf\ComposerStager\Domain\Core\Stager\StagerInterface;
use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* Defines a service that updates via cron.
......@@ -60,8 +71,28 @@ class CronUpdater extends Updater {
* The state service.
* @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
* The config factory service.
* @param mixed ...$arguments
* Additional arguments to pass to the parent constructor.
* @param \Drupal\package_manager\ComposerInspector $composerInspector
* The Composer inspector service.
* @param \Drupal\package_manager\PathLocator $pathLocator
* The path locator service.
* @param \PhpTuf\ComposerStager\Domain\Core\Beginner\BeginnerInterface $beginner
* The beginner service.
* @param \PhpTuf\ComposerStager\Domain\Core\Stager\StagerInterface $stager
* The stager service.
* @param \PhpTuf\ComposerStager\Domain\Core\Committer\CommitterInterface $committer
* The committer service.
* @param \Drupal\Core\File\FileSystemInterface $fileSystem
* The file system service.
* @param \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $eventDispatcher
* The event dispatcher service.
* @param \Drupal\Core\TempStore\SharedTempStoreFactory $tempStoreFactory
* The shared tempstore factory.
* @param \Drupal\Component\Datetime\TimeInterface $time
* The time service.
* @param \PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface $pathFactory
* The path factory service.
* @param \Drupal\package_manager\FailureMarker $failureMarker
* The failure marker service.
*/
public function __construct(
protected ReleaseChooser $releaseChooser,
......@@ -69,9 +100,19 @@ class CronUpdater extends Updater {
protected StatusCheckMailer $statusCheckMailer,
protected StateInterface $state,
protected ConfigFactoryInterface $configFactory,
mixed ...$arguments,
ComposerInspector $composerInspector,
PathLocator $pathLocator,
BeginnerInterface $beginner,
StagerInterface $stager,
CommitterInterface $committer,
FileSystemInterface $fileSystem,
EventDispatcherInterface $eventDispatcher,
SharedTempStoreFactory $tempStoreFactory,
TimeInterface $time,
PathFactoryInterface $pathFactory,
FailureMarker $failureMarker,
) {
parent::__construct(...$arguments);
parent::__construct($composerInspector, $pathLocator, $beginner, $stager, $committer, $fileSystem, $eventDispatcher, $tempStoreFactory, $time, $pathFactory, $failureMarker);
}
/**
......
......@@ -4,9 +4,19 @@ declare(strict_types = 1);
namespace Drupal\automatic_updates;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\TempStore\SharedTempStoreFactory;
use Drupal\package_manager\ComposerInspector;
use Drupal\package_manager\FailureMarker;
use Drupal\package_manager\PathLocator;
use Drupal\package_manager\Stage;
use PhpTuf\ComposerStager\Domain\Core\Beginner\BeginnerInterface;
use PhpTuf\ComposerStager\Domain\Core\Committer\CommitterInterface;
use PhpTuf\ComposerStager\Domain\Core\Stager\StagerInterface;
use PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* Defines a service to perform updates.
......@@ -23,11 +33,41 @@ class Updater extends Stage {
*
* @param \Drupal\package_manager\ComposerInspector $composerInspector
* The Composer inspector service.
* @param mixed ...$arguments
* Additional arguments to pass to the parent constructor.
* @param \Drupal\package_manager\PathLocator $pathLocator
* The path locator service.
* @param \PhpTuf\ComposerStager\Domain\Core\Beginner\BeginnerInterface $beginner
* The beginner service.
* @param \PhpTuf\ComposerStager\Domain\Core\Stager\StagerInterface $stager
* The stager service.
* @param \PhpTuf\ComposerStager\Domain\Core\Committer\CommitterInterface $committer
* The committer service.
* @param \Drupal\Core\File\FileSystemInterface $fileSystem
* The file system service.
* @param \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $eventDispatcher
* The event dispatcher service.
* @param \Drupal\Core\TempStore\SharedTempStoreFactory $tempStoreFactory
* The shared tempstore factory.
* @param \Drupal\Component\Datetime\TimeInterface $time
* The time service.
* @param \PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface $pathFactory
* The path factory service.
* @param \Drupal\package_manager\FailureMarker $failureMarker
* The failure marker service.
*/
public function __construct(protected ComposerInspector $composerInspector, mixed ...$arguments) {
parent::__construct(...$arguments);
public function __construct(
protected ComposerInspector $composerInspector,
PathLocator $pathLocator,
BeginnerInterface $beginner,
StagerInterface $stager,
CommitterInterface $committer,
FileSystemInterface $fileSystem,
EventDispatcherInterface $eventDispatcher,
SharedTempStoreFactory $tempStoreFactory,
TimeInterface $time,
PathFactoryInterface $pathFactory,
FailureMarker $failureMarker,
) {
parent::__construct($pathLocator, $beginner, $stager, $committer, $fileSystem, $eventDispatcher, $tempStoreFactory, $time, $pathFactory, $failureMarker);
}
/**
......
......@@ -10,7 +10,7 @@ use Drupal\automatic_updates\Updater;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface;
use Drupal\package_manager\Event\PostApplyEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
......@@ -34,7 +34,7 @@ final class StatusChecker implements EventSubscriberInterface {
* The key/value expirable factory.
* @param \Drupal\Component\Datetime\TimeInterface $time
* The time service.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher
* @param \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $eventDispatcher
* The event dispatcher service.
* @param \Drupal\automatic_updates\Updater $updater
* The updater service.
......
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