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

Restore a few things

parent 9af8839a
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,12 @@ services:
- '@update.manager'
tags:
- { name: event_subscriber }
automatic_updates.excluded_paths_subscriber:
class: Drupal\automatic_updates\Event\ExcludedPathsSubscriber
arguments:
- '@extension.list.module'
tags:
- { name: event_subscriber }
automatic_updates.staged_projects_validator:
class: Drupal\automatic_updates\Validator\StagedProjectsValidator
arguments:
......@@ -64,9 +70,3 @@ services:
class: Drupal\automatic_updates\Validator\CoreComposerValidator
tags:
- { name: event_subscriber }
automatic_updates.excluded_paths_subscriber:
class: Drupal\automatic_updates\Event\ExcludedPathsSubscriber
arguments:
- '@extension.list.module'
tags:
- { name: event_subscriber }
......@@ -2,12 +2,13 @@
namespace Drupal\automatic_updates\Event;
use Drupal\automatic_updates\Updater;
use Drupal\Core\Extension\ModuleExtensionList;
use Drupal\package_manager\Event\PreCreateEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* Defines an event subscriber to exclude certain paths from staging areas.
* Defines an event subscriber to exclude certain paths from update operations.
*/
class ExcludedPathsSubscriber implements EventSubscriberInterface {
......@@ -29,14 +30,15 @@ class ExcludedPathsSubscriber implements EventSubscriberInterface {
}
/**
* Excludes paths from a staging area before it is created.
* Reacts to the beginning of an update process.
*
* @param \Drupal\package_manager\Event\PreCreateEvent $event
* The event object.
*/
public function preCreate(PreCreateEvent $event): void {
// If this module is a git clone, exclude it.
if (is_dir(__DIR__ . '/../../.git')) {
// If we are doing an automatic update and this module is a git clone,
// exclude it.
if ($event->getStage() instanceof Updater && is_dir(__DIR__ . '/../../.git')) {
$dir = $this->moduleList->getPath('automatic_updates');
$event->excludePath($dir);
}
......
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