From f609b79e0fd1a1616ae2a47814b4148c9835352c Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Wed, 29 Jan 2025 10:16:29 -0400 Subject: [PATCH] Adjust flow; avoid unnecessary listing. --- .../ConfigTransformationEventSubscriber.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/EventSubscriber/ConfigTransformationEventSubscriber.php b/src/EventSubscriber/ConfigTransformationEventSubscriber.php index b05b4ea..893d686 100644 --- a/src/EventSubscriber/ConfigTransformationEventSubscriber.php +++ b/src/EventSubscriber/ConfigTransformationEventSubscriber.php @@ -17,7 +17,13 @@ */ class ConfigTransformationEventSubscriber implements EventSubscriberInterface, ContainerInjectionInterface { - const PRIORITY = 250; + protected const PRIORITY = 250; + + protected const PREFIXES_TO_IGNORE = [ + 'migrate_plus.migration.isi__', + 'migrate_plus.migration_group.isi__', + 'islandora_spreadsheet_ingest.request.', + ]; /** * Constructor. @@ -55,8 +61,8 @@ public static function getSubscribedEvents() : array { */ public function onExportTransform(StorageTransformEvent $event) : void { $storage = $event->getStorage(); - foreach ($this->toIgnore($storage) as $name) { - $storage->delete($name); + foreach (static::PREFIXES_TO_IGNORE as $prefix) { + $storage->deleteAll($prefix); } } @@ -93,9 +99,9 @@ public function onImportTransform(StorageTransformEvent $event) : void { * The names of the configs that should never be changed on imports/exports. */ protected static function toIgnore(StorageInterface $storage) : \Generator { - yield from $storage->listAll('migrate_plus.migration.isi__'); - yield from $storage->listAll('migrate_plus.migration_group.isi__'); - yield from $storage->listAll('islandora_spreadsheet_ingest.request.'); + foreach (static::PREFIXES_TO_IGNORE as $prefix) { + yield from $storage->listAll($prefix); + } } }