Skip to content

Commit

Permalink
Reduce event importer invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Jan 12, 2024
1 parent b38bede commit ff95778
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ _core:
default_config_hash: v7E8C8wJWeAW2BGohMNY1tZSBc4bexM6O62tGxecTfE
mode: simple
ignored_config_entities:
- 'build_hooks.frontend_environment.*'
- 'google_tag.container.*'
- 'next.next_entity_type_config.*'
- 'next.next_site.*'
- 'system.action.user_add_role_action.custm_*'
- 'system.action.user_remove_role_action.custm_*'
- 'user.role.custm_*'
- 'build_hooks.frontend_environment.*'
enable_export_filtering: false
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ source:
request_options:
timeout: 60
urls: { }
data_parser_plugin: localist_json
data_parser_plugin: sul_localist_json
item_selector: events
orphan_action: forget
fields:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Drupal\sul_helper\Plugin\migrate_plus\data_parser;

use Drupal\stanford_migrate\Plugin\migrate_plus\data_parser\LocalistJson;

/**
* Obtain JSON data for migration.
*
* @DataParser(
* id = "sul_localist_json",
* title = @Translation("SUL Localist JSON")
* )
*/
class SulLocalistJson extends LocalistJson {

protected function getSourceData(string $url): array {
$source_data = parent::getSourceData($url);

$event_ids = [];
foreach ($source_data as $key => $item) {
if (in_array($item['event']['id'], $event_ids)) {
unset($source_data[$key]);
continue;
}
$event_ids[] = $item['event']['id'];
}
return array_values($source_data);
}

}

0 comments on commit ff95778

Please sign in to comment.