From 7ab04458b85d474c20df2d78825b267e5d704176 Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Mon, 2 Dec 2024 08:50:09 +0200 Subject: [PATCH 1/5] UHF-9937: Make sure removed job listings are not published --- .../crons/migrate-changed-job-listings.sh | 11 +- .../openshift/crons/migrate-job-listings.sh | 1 - .../JobListingHideMissingSubscriber.php | 20 +++- .../Plugin/QueueWorker/UnpublishWorker.php | 33 +++--- .../tests/src/Kernel/UnpublishWorkerTest.php | 105 ++++++++++++++++++ 5 files changed, 146 insertions(+), 24 deletions(-) create mode 100644 public/modules/custom/helfi_rekry_content/tests/src/Kernel/UnpublishWorkerTest.php diff --git a/docker/openshift/crons/migrate-changed-job-listings.sh b/docker/openshift/crons/migrate-changed-job-listings.sh index 655d7dbb..12f1b580 100644 --- a/docker/openshift/crons/migrate-changed-job-listings.sh +++ b/docker/openshift/crons/migrate-changed-job-listings.sh @@ -1,11 +1,18 @@ #!/bin/bash +migrations=( + "helfi_rekry_jobs:all" +) + echo "Starting job listing:changed migrations: $(date)" while true do echo "Running job listing:changed migrations: $(date)" - # Allow migrations to be run every 10 minutes, reset stuck migrations every 30 minutes. - drush migrate:import helfi_rekry_jobs:changed --update --reset-threshold 1800 --interval 600 --no-progress + + for migration in "${migrations[@]}"; do + # Allow migrations to be run every 10 minutes, reset stuck migrations every 30 minutes. + drush migrate:import "$migration" --reset-threshold 1800 --interval 600 --no-progress + done # Sleep for 15 minutes. sleep 900 diff --git a/docker/openshift/crons/migrate-job-listings.sh b/docker/openshift/crons/migrate-job-listings.sh index f7fd0d21..152b36fa 100644 --- a/docker/openshift/crons/migrate-job-listings.sh +++ b/docker/openshift/crons/migrate-job-listings.sh @@ -11,7 +11,6 @@ migrations=( "helfi_rekry_organizations:en" "helfi_rekry_employments:all" "helfi_rekry_employment_types:all" - "helfi_rekry_jobs:all" ) echo "Starting job listing migrations: $(date)" diff --git a/public/modules/custom/helfi_rekry_content/src/EventSubscriber/JobListingHideMissingSubscriber.php b/public/modules/custom/helfi_rekry_content/src/EventSubscriber/JobListingHideMissingSubscriber.php index e2ae1593..d97efc7b 100644 --- a/public/modules/custom/helfi_rekry_content/src/EventSubscriber/JobListingHideMissingSubscriber.php +++ b/public/modules/custom/helfi_rekry_content/src/EventSubscriber/JobListingHideMissingSubscriber.php @@ -7,6 +7,7 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Queue\QueueFactory; use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\node\NodeInterface; use Drush\Drupal\Migrate\MigrateMissingSourceRowsEvent; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; @@ -83,14 +84,21 @@ function ($values, $destinationValue) { return; } - // Query missing nodes that are still published. - $query = $this->entityTypeManager->getStorage('node') - ->getQuery() + $query = $this->entityTypeManager + ->getStorage('node') + ->getQuery(); + + // Query missing nodes that are still published + // or still scheduled to be published. + $orCondition = $query->orConditionGroup(); + $orCondition->condition('status', NodeInterface::PUBLISHED); + $orCondition->exists('publish_on'); + + $nids = $query ->accessCheck(FALSE) ->condition('nid', $destinationIds, 'IN') - ->condition('status', 1) - ->notExists('unpublish_on'); - $nids = $query->execute(); + ->condition($orCondition) + ->execute(); foreach ($nids as $nid) { $job = ['nid' => $nid]; diff --git a/public/modules/custom/helfi_rekry_content/src/Plugin/QueueWorker/UnpublishWorker.php b/public/modules/custom/helfi_rekry_content/src/Plugin/QueueWorker/UnpublishWorker.php index e810e311..427b8b4b 100644 --- a/public/modules/custom/helfi_rekry_content/src/Plugin/QueueWorker/UnpublishWorker.php +++ b/public/modules/custom/helfi_rekry_content/src/Plugin/QueueWorker/UnpublishWorker.php @@ -6,20 +6,21 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\Core\Queue\Attribute\QueueWorker; use Drupal\Core\Queue\QueueWorkerBase; +use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\node\NodeInterface; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Queue Worker for removing job listings not present in source. - * - * @QueueWorker( - * id = "job_listing_unpublish_worker", - * title = @Translation("Job listing unpublish worker"), - * cron = {"time" = 60} - * ) */ +#[QueueWorker( + id: 'job_listing_unpublish_worker', + title: new TranslatableMarkup('Job listing unpublish worker'), + cron: ['time' => 60], +)] final class UnpublishWorker extends QueueWorkerBase implements ContainerFactoryPluginInterface { /** @@ -74,7 +75,9 @@ public function processItem($data): void { // Unpublish all translations. if ($node instanceof NodeInterface && $node->getType() == 'job_listing') { - foreach (['fi', 'sv', 'en'] as $langcode) { + foreach ($node->getTranslationLanguages() as $language) { + $langcode = $language->getId(); + // Unpublish the job listing node as it's still published, but it's // no longer available at the source. if (!$node->hasTranslation($langcode)) { @@ -82,15 +85,15 @@ public function processItem($data): void { } $translation = $node->getTranslation($langcode); - if ($translation->isPublished()) { - $translation->setUnpublished(); - if ($translation->hasField('publish_on') && !empty($translation->get('publish_on')->getValue())) { - // Also clear the publish on date to make sure the translation is - // not going to be re-published. - $translation->set('publish_on', NULL); - } - $translation->save(); + $translation->setUnpublished(); + + // Also clear the published on date so the translation + // is not going to be re-published. + if ($translation->hasField('publish_on') && !empty($translation->get('publish_on')->getValue())) { + $translation->set('publish_on', NULL); } + + $translation->save(); } } diff --git a/public/modules/custom/helfi_rekry_content/tests/src/Kernel/UnpublishWorkerTest.php b/public/modules/custom/helfi_rekry_content/tests/src/Kernel/UnpublishWorkerTest.php new file mode 100644 index 00000000..329cb233 --- /dev/null +++ b/public/modules/custom/helfi_rekry_content/tests/src/Kernel/UnpublishWorkerTest.php @@ -0,0 +1,105 @@ +installEntitySchema('node'); + $this->installEntitySchema('user'); + $this->installSchema('node', 'node_access'); + $this->installConfig(['node', 'filter']); + $this->createContentType(['type' => 'job_listing']); + } + + /** + * Tests unpublish worker. + */ + public function testUnpublishWorker(): void { + $manager = $this->container->get('plugin.manager.queue_worker'); + $sut = $manager->createInstance('job_listing_unpublish_worker'); + + $published_node = $this->createNode([ + 'type' => 'job_listing', + 'status' => NodeInterface::PUBLISHED, + ]); + + $scheduled_node = $this->createNode([ + 'type' => 'job_listing', + 'status' => NodeInterface::NOT_PUBLISHED, + ]); + + ConfigurableLanguage::createFromLangcode('sv')->save(); + $translated_node = $this->createNode([ + 'type' => 'job_listing', + 'langcode' => 'en', + 'status' => NodeInterface::NOT_PUBLISHED, + ]); + $translated_node->addTranslation('sv', [ + 'title' => $this->randomMachineName(), + 'status' => NodeInterface::PUBLISHED, + ])->save(); + + $sut->processItem(['nid' => $published_node->id()]); + $this->assertNodeIsUnpublished($published_node->id()); + + $sut->processItem(['nid' => $scheduled_node->id()]); + $this->assertNodeIsUnpublished($scheduled_node->id()); + + $sut->processItem(['nid' => $translated_node->id()]); + $this->assertNodeIsUnpublished($translated_node->id()); + } + + /** + * Asserts that node is no longer published. + */ + private function assertNodeIsUnpublished(string $nid): void { + /** @var \Drupal\node\NodeInterface $node */ + $node = $this->container->get(EntityTypeManagerInterface::class) + ->getStorage('node') + ->load($nid); + + foreach ($node->getTranslationLanguages() as $language) { + $translation = $node->getTranslation($language->getId()); + $this->assertFalse($translation->isPublished()); + $this->assertEmpty($translation->get('publish_on')->getValue()); + } + } + +} From d21ce7efa98f24c36daa803310d7441a6730ecb0 Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Mon, 2 Dec 2024 15:15:29 +0200 Subject: [PATCH 2/5] UHF-9937: Rename scripts --- .../crons/migrate-changed-job-listings.sh | 19 ------------ docker/openshift/crons/migrate-helbit-data.sh | 30 +++++++++++++++++++ .../openshift/crons/migrate-job-listings.sh | 21 ++++--------- 3 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 docker/openshift/crons/migrate-changed-job-listings.sh create mode 100644 docker/openshift/crons/migrate-helbit-data.sh diff --git a/docker/openshift/crons/migrate-changed-job-listings.sh b/docker/openshift/crons/migrate-changed-job-listings.sh deleted file mode 100644 index 12f1b580..00000000 --- a/docker/openshift/crons/migrate-changed-job-listings.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -migrations=( - "helfi_rekry_jobs:all" -) - -echo "Starting job listing:changed migrations: $(date)" -while true -do - echo "Running job listing:changed migrations: $(date)" - - for migration in "${migrations[@]}"; do - # Allow migrations to be run every 10 minutes, reset stuck migrations every 30 minutes. - drush migrate:import "$migration" --reset-threshold 1800 --interval 600 --no-progress - done - - # Sleep for 15 minutes. - sleep 900 -done diff --git a/docker/openshift/crons/migrate-helbit-data.sh b/docker/openshift/crons/migrate-helbit-data.sh new file mode 100644 index 00000000..bd9bf638 --- /dev/null +++ b/docker/openshift/crons/migrate-helbit-data.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +migrations=( + "helfi_rekry_images:all" + "helfi_rekry_videos:all" + "helfi_rekry_task_areas:fi" + "helfi_rekry_task_areas:sv" + "helfi_rekry_task_areas:en" + "helfi_rekry_organizations:fi" + "helfi_rekry_organizations:sv" + "helfi_rekry_organizations:en" + "helfi_rekry_employments:all" + "helfi_rekry_employment_types:all" +) + +echo "Starting helbit migrations: $(date)" +while true +do + echo "Running helbit migrations: $(date)" + + for migration in "${migrations[@]}"; do + # Allow migrations to be run every 1.5 hours, reset stuck migrations every 12 hours. + drush migrate:import "$migration" --reset-threshold 43200 --interval 5400 --no-progress + done + + drush helfi-rekry-content:clean-expired-listings + + # Sleep for 3 hours. + sleep 10800 +done diff --git a/docker/openshift/crons/migrate-job-listings.sh b/docker/openshift/crons/migrate-job-listings.sh index 152b36fa..c39f20b3 100644 --- a/docker/openshift/crons/migrate-job-listings.sh +++ b/docker/openshift/crons/migrate-job-listings.sh @@ -1,16 +1,7 @@ #!/bin/bash migrations=( - "helfi_rekry_images:all" - "helfi_rekry_videos:all" - "helfi_rekry_task_areas:fi" - "helfi_rekry_task_areas:sv" - "helfi_rekry_task_areas:en" - "helfi_rekry_organizations:fi" - "helfi_rekry_organizations:sv" - "helfi_rekry_organizations:en" - "helfi_rekry_employments:all" - "helfi_rekry_employment_types:all" + "helfi_rekry_jobs:all" ) echo "Starting job listing migrations: $(date)" @@ -19,12 +10,10 @@ do echo "Running job listing migrations: $(date)" for migration in "${migrations[@]}"; do - # Allow migrations to be run every 1.5 hours, reset stuck migrations every 12 hours. - drush migrate:import "$migration" --reset-threshold 43200 --interval 5400 --no-progress + # Allow migrations to be run every 10 minutes, reset stuck migrations every 30 minutes. + drush migrate:import "$migration" --reset-threshold 1800 --interval 600 --no-progress done - drush helfi-rekry-content:clean-expired-listings - - # Sleep for 3 hours. - sleep 10800 + # Sleep for 15 minutes. + sleep 900 done From 693b3ca5de2eae68bbeba6db4a20dea1bf80d624 Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Mon, 2 Dec 2024 15:22:12 +0200 Subject: [PATCH 3/5] UHF-9937: Remove changed migration --- .../openshift/crons/migrate-job-listings.sh | 2 +- .../migrations/job_listings.yml | 1 - .../Plugin/Deriver/HelbitMigrationDeriver.php | 6 +---- .../Plugin/migrate/source/HelbitOpenJobs.php | 4 ---- .../src/Kernel/HelbitMigrationDeriverTest.php | 13 ----------- .../tests/src/Kernel/HelbitOpenJobsTest.php | 23 ------------------- 6 files changed, 2 insertions(+), 47 deletions(-) diff --git a/docker/openshift/crons/migrate-job-listings.sh b/docker/openshift/crons/migrate-job-listings.sh index c39f20b3..ee822fb1 100644 --- a/docker/openshift/crons/migrate-job-listings.sh +++ b/docker/openshift/crons/migrate-job-listings.sh @@ -1,7 +1,7 @@ #!/bin/bash migrations=( - "helfi_rekry_jobs:all" + "helfi_rekry_jobs" ) echo "Starting job listing migrations: $(date)" diff --git a/public/modules/custom/helfi_rekry_content/migrations/job_listings.yml b/public/modules/custom/helfi_rekry_content/migrations/job_listings.yml index 7f12af52..39345e2b 100644 --- a/public/modules/custom/helfi_rekry_content/migrations/job_listings.yml +++ b/public/modules/custom/helfi_rekry_content/migrations/job_listings.yml @@ -5,7 +5,6 @@ dependencies: module: - helfi_rekry_content id: helfi_rekry_jobs -deriver: Drupal\helfi_rekry_content\Plugin\Deriver\HelbitMigrationDeriver migration_tags: - helfi_rekry_content - helfi_rekry_jobs diff --git a/public/modules/custom/helfi_rekry_content/src/Plugin/Deriver/HelbitMigrationDeriver.php b/public/modules/custom/helfi_rekry_content/src/Plugin/Deriver/HelbitMigrationDeriver.php index ab950950..41029dbb 100644 --- a/public/modules/custom/helfi_rekry_content/src/Plugin/Deriver/HelbitMigrationDeriver.php +++ b/public/modules/custom/helfi_rekry_content/src/Plugin/Deriver/HelbitMigrationDeriver.php @@ -36,7 +36,7 @@ public static function create(ContainerInterface $container, $base_plugin_id) : */ public function getDerivativeDefinitions($base_plugin_definition): array { $langcodes = ['fi', 'sv', 'en']; - $derivatives = ['all', 'changed']; + $derivatives = ['all']; if ($base_plugin_definition['source']['plugin'] == 'helbit_open_jobs') { foreach ($derivatives as $key) { @@ -64,10 +64,6 @@ public function getDerivativeDefinitions($base_plugin_definition): array { * Modified plugin definition for derivative. */ private function getJobMigrationDerivativeValues(array $base_plugin_definition, string $key): array { - if (str_starts_with($key, 'changed')) { - $base_plugin_definition['source']['changed'] = TRUE; - } - return $base_plugin_definition; } diff --git a/public/modules/custom/helfi_rekry_content/src/Plugin/migrate/source/HelbitOpenJobs.php b/public/modules/custom/helfi_rekry_content/src/Plugin/migrate/source/HelbitOpenJobs.php index 838048a7..18e218ca 100644 --- a/public/modules/custom/helfi_rekry_content/src/Plugin/migrate/source/HelbitOpenJobs.php +++ b/public/modules/custom/helfi_rekry_content/src/Plugin/migrate/source/HelbitOpenJobs.php @@ -50,10 +50,6 @@ protected function initializeIterator(): \Iterator { $query = []; - if ($this->configuration['changed'] ?? FALSE) { - $query['timestamp'] = date('Y-m-d\TH:m:i', strtotime('-1 day')); - } - foreach ($langcodes as $langcode) { foreach ($this->helbit->getJobListings($langcode, $query) as $row) { $fields = $this->getFieldsFromRow($row) + [ diff --git a/public/modules/custom/helfi_rekry_content/tests/src/Kernel/HelbitMigrationDeriverTest.php b/public/modules/custom/helfi_rekry_content/tests/src/Kernel/HelbitMigrationDeriverTest.php index 8cd3a65a..4f209c27 100644 --- a/public/modules/custom/helfi_rekry_content/tests/src/Kernel/HelbitMigrationDeriverTest.php +++ b/public/modules/custom/helfi_rekry_content/tests/src/Kernel/HelbitMigrationDeriverTest.php @@ -21,19 +21,6 @@ class HelbitMigrationDeriverTest extends KernelTestBase { * Tests Helbit deriver. */ public function testHelbitDeriver(): void { - $deriver = new HelbitMigrationDeriver(new Settings(self::TEST_HELBIT_KEY)); - $result = $deriver->getDerivativeDefinitions([ - 'id' => 'helfi_rekry_jobs', - 'source' => [ - 'plugin' => 'helbit_open_jobs', - ], - ]); - - $this->assertArrayHasKey('all', $result); - $this->assertArrayHasKey('changed', $result); - $this->assertEmpty($result['all']['source']['changed'] ?? NULL); - $this->assertTrue($result['changed']['source']['changed']); - $deriver = new HelbitMigrationDeriver(new Settings(self::TEST_HELBIT_KEY)); $result = $deriver->getDerivativeDefinitions([ 'id' => 'helfi_rekry_task_areas', diff --git a/public/modules/custom/helfi_rekry_content/tests/src/Kernel/HelbitOpenJobsTest.php b/public/modules/custom/helfi_rekry_content/tests/src/Kernel/HelbitOpenJobsTest.php index 0e51f0de..355366ee 100644 --- a/public/modules/custom/helfi_rekry_content/tests/src/Kernel/HelbitOpenJobsTest.php +++ b/public/modules/custom/helfi_rekry_content/tests/src/Kernel/HelbitOpenJobsTest.php @@ -50,29 +50,6 @@ public function testException(): void { ->next(); } - /** - * Tests that changed timestamp is present in request when configured. - */ - public function testChangedTimestamp(): void { - $isValidTime = static fn (array $query) => preg_match('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/', $query['timestamp']); - - $helbit = $this->prophesize(HelbitClient::class); - $helbit - ->getJobListings(Argument::any(), Argument::that($isValidTime)) - ->shouldBeCalled(); - - $this - ->getSut($helbit->reveal(), [ - 'changed' => TRUE, - 'ids' => [ - 'id' => [ - 'type' => 'string', - ], - ], - ]) - ->next(); - } - /** * Tests iterator. */ From 598cd03580d9d3525824c165a0f64f31bb148e31 Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Mon, 2 Dec 2024 15:22:25 +0200 Subject: [PATCH 4/5] UHF-9937: Update documentation --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fbfd1195..36401cd4 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ search found on the site and provides other recruitment information for the city Env | Branch | Drush alias | URL --- | ------ | ----------- | --- development | * | - | http://helfi-rekry.docker.so/ -production | main | @main | TBD +production | main | @main | https://www.hel.fi/fi/avoimet-tyopaikat ## Requirements @@ -110,7 +110,7 @@ listings are published for indexing. - The `helfi_rekry_content` module code can be found from [here](https://github.com/City-of-Helsinki/drupal-helfi-rekry/tree/dev/public/modules/custom/helfi_rekry_content). - The migration interval for the new job listings can be checked from the cron configuration [here](https://github.com/City-of-Helsinki/drupal-helfi-rekry/blob/dev/docker/openshift/crons/migrate-job-listings.sh). -- The migration interval for changed job listings poll is written on this cron configuration [here](https://github.com/City-of-Helsinki/drupal-helfi-rekry/blob/dev/docker/openshift/crons/migrate-changed-job-listings.sh). +- The migration interval for images, taxonomy terms, etc. is written on this cron configuration [here](https://github.com/City-of-Helsinki/drupal-helfi-rekry/blob/dev/docker/openshift/crons/migrate-helbit-data.sh). - The scheduled publishing interval can be checked from this cron configuration [here](https://github.com/City-of-Helsinki/drupal-helfi-rekry/blob/dev/docker/openshift/crons/content-scheduler.sh). ### Testing on local From 3146b86b79d3f9322bae925e9dbdc00f51daeb97 Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Mon, 2 Dec 2024 16:30:24 +0200 Subject: [PATCH 5/5] UHF-9937: Remove deriver --- docker/openshift/crons/migrate-helbit-data.sh | 8 +++--- .../migrations/employment_types.yml | 1 - .../migrations/employments.yml | 1 - .../migrations/job_listing_images.yml | 1 - .../migrations/job_listing_videos.yml | 1 - .../Plugin/Deriver/HelbitMigrationDeriver.php | 27 ++----------------- 6 files changed, 6 insertions(+), 33 deletions(-) diff --git a/docker/openshift/crons/migrate-helbit-data.sh b/docker/openshift/crons/migrate-helbit-data.sh index bd9bf638..0b1b6d53 100644 --- a/docker/openshift/crons/migrate-helbit-data.sh +++ b/docker/openshift/crons/migrate-helbit-data.sh @@ -1,16 +1,16 @@ #!/bin/bash migrations=( - "helfi_rekry_images:all" - "helfi_rekry_videos:all" + "helfi_rekry_images" + "helfi_rekry_videos" "helfi_rekry_task_areas:fi" "helfi_rekry_task_areas:sv" "helfi_rekry_task_areas:en" "helfi_rekry_organizations:fi" "helfi_rekry_organizations:sv" "helfi_rekry_organizations:en" - "helfi_rekry_employments:all" - "helfi_rekry_employment_types:all" + "helfi_rekry_employments" + "helfi_rekry_employment_types" ) echo "Starting helbit migrations: $(date)" diff --git a/public/modules/custom/helfi_rekry_content/migrations/employment_types.yml b/public/modules/custom/helfi_rekry_content/migrations/employment_types.yml index 47b7b8a4..ca1a9903 100644 --- a/public/modules/custom/helfi_rekry_content/migrations/employment_types.yml +++ b/public/modules/custom/helfi_rekry_content/migrations/employment_types.yml @@ -5,7 +5,6 @@ dependencies: module: - helfi_rekry_content id: helfi_rekry_employment_types -deriver: Drupal\helfi_rekry_content\Plugin\Deriver\HelbitMigrationDeriver migration_tags: - helfi_rekry_content - helfi_rekry_jobs diff --git a/public/modules/custom/helfi_rekry_content/migrations/employments.yml b/public/modules/custom/helfi_rekry_content/migrations/employments.yml index 9db81a72..b1e52765 100644 --- a/public/modules/custom/helfi_rekry_content/migrations/employments.yml +++ b/public/modules/custom/helfi_rekry_content/migrations/employments.yml @@ -5,7 +5,6 @@ dependencies: module: - helfi_rekry_content id: helfi_rekry_employments -deriver: Drupal\helfi_rekry_content\Plugin\Deriver\HelbitMigrationDeriver migration_tags: - helfi_rekry_content - helfi_rekry_jobs diff --git a/public/modules/custom/helfi_rekry_content/migrations/job_listing_images.yml b/public/modules/custom/helfi_rekry_content/migrations/job_listing_images.yml index f6528796..6a1b4686 100644 --- a/public/modules/custom/helfi_rekry_content/migrations/job_listing_images.yml +++ b/public/modules/custom/helfi_rekry_content/migrations/job_listing_images.yml @@ -5,7 +5,6 @@ dependencies: module: - helfi_rekry_content id: helfi_rekry_images -deriver: Drupal\helfi_rekry_content\Plugin\Deriver\HelbitMigrationDeriver migration_tags: - helfi_rekry_content - helfi_rekry_jobs diff --git a/public/modules/custom/helfi_rekry_content/migrations/job_listing_videos.yml b/public/modules/custom/helfi_rekry_content/migrations/job_listing_videos.yml index 762f37a8..7e91819c 100644 --- a/public/modules/custom/helfi_rekry_content/migrations/job_listing_videos.yml +++ b/public/modules/custom/helfi_rekry_content/migrations/job_listing_videos.yml @@ -5,7 +5,6 @@ dependencies: module: - helfi_rekry_content id: helfi_rekry_videos -deriver: Drupal\helfi_rekry_content\Plugin\Deriver\HelbitMigrationDeriver migration_tags: - helfi_rekry_content - helfi_rekry_jobs diff --git a/public/modules/custom/helfi_rekry_content/src/Plugin/Deriver/HelbitMigrationDeriver.php b/public/modules/custom/helfi_rekry_content/src/Plugin/Deriver/HelbitMigrationDeriver.php index 41029dbb..d280232d 100644 --- a/public/modules/custom/helfi_rekry_content/src/Plugin/Deriver/HelbitMigrationDeriver.php +++ b/public/modules/custom/helfi_rekry_content/src/Plugin/Deriver/HelbitMigrationDeriver.php @@ -36,37 +36,14 @@ public static function create(ContainerInterface $container, $base_plugin_id) : */ public function getDerivativeDefinitions($base_plugin_definition): array { $langcodes = ['fi', 'sv', 'en']; - $derivatives = ['all']; - if ($base_plugin_definition['source']['plugin'] == 'helbit_open_jobs') { - foreach ($derivatives as $key) { - $this->derivatives[$key] = $this->getJobMigrationDerivativeValues($base_plugin_definition, $key); - } - } - else { - foreach ($langcodes as $langcode) { - $this->derivatives[$langcode] = $this->getDerivativeValues($base_plugin_definition, $langcode); - } + foreach ($langcodes as $langcode) { + $this->derivatives[$langcode] = $this->getDerivativeValues($base_plugin_definition, $langcode); } return $this->derivatives; } - /** - * Creates a derivative definition for job migration. - * - * @param array $base_plugin_definition - * Base migration definitions. - * @param string $key - * Key for derivative. - * - * @return array - * Modified plugin definition for derivative. - */ - private function getJobMigrationDerivativeValues(array $base_plugin_definition, string $key): array { - return $base_plugin_definition; - } - /** * Creates a derivative definition for each available language. *