Skip to content
Snippets Groups Projects

Issue #3245996: Move basic exclusions and test coverage into Package Manager

Merged Issue #3245996: Move basic exclusions and test coverage into Package Manager
All threads resolved!
All threads resolved!
2 files
+ 12
10
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -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);
}
Loading