Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust flow; avoid unnecessary listing. #120

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/EventSubscriber/ConfigTransformationEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

}