Skip to content
Snippets Groups Projects
Commit 2f1da859 authored by Fran Garcia-Linares's avatar Fran Garcia-Linares
Browse files

Fix CI.

parent bc199c96
Branches
No related tags found
No related merge requests found
Pipeline #457059 passed with warnings
Showing
with 368 additions and 355 deletions
addressfield
advagg
casestudy
changenotice
devdrupal
devwww
drupalsystems
etid
mainimage
opendocument
tnid
versioncontrol
<?php
/**
* @file
* Drupal.org Custom Migrations install hooks.
*/
use Drupal\Core\Database\Database;
/**
......
......@@ -60,4 +60,3 @@ function drupalorg_migrate_migration_plugins_alter(array &$migrations) {
}
}
}
......@@ -5,7 +5,7 @@ id: drupalorg_migrate_casestudy_upload_media_documents
# - 'Drupal 7'
# - Content
migration_group: drupalorg_migrate
label: 'Case study upolad field documents to Media entities'
label: 'Case study upload field documents to Media entities'
source:
plugin: d7_file_casestudy_files
......
......@@ -41,13 +41,13 @@ process:
field_demonstrated_by: field_demonstrated_by
field_how_to_learn: field_how_to_learn
field_required_skills:
plugin: sub_process
source: field_required_skills
process:
target_id:
plugin: migration_lookup
migration: drupalorg_migrate_contributor_skill
source: target_id
plugin: sub_process
source: field_required_skills
process:
target_id:
plugin: migration_lookup
migration: drupalorg_migrate_contributor_skill
source: target_id
migration_dependencies:
optional:
- drupalorg_migrate_users
......
......@@ -25,10 +25,10 @@ process:
field_project_machine_name: field_project_machine_name
# field_project_images: field_project_images
# group_project_classification:
# field_module_categories:
# plugin: migration_lookup
# migration: drupalorg_migrate_module_categories
# source: taxonomy_vocabulary_3
# field_module_categories:
# plugin: migration_lookup
# migration: drupalorg_migrate_module_categories
# source: taxonomy_vocabulary_3
field_maintenance_status:
plugin: migration_lookup
migration: drupalorg_migrate_maintenance_status
......@@ -81,11 +81,11 @@ migration_dependencies:
required:
- drupalorg_migrate_development_status
- drupalorg_migrate_maintenance_status
# - drupalorg_migrate_module_categories
# - drupalorg_migrate_module_categories
# https://www.drupal.org/project/drupal/issues/2797505#comment-12129356
optional:
- drupalorg_migrate_users
# - drupalorg_migrate_field_collection_supporting_organizations
# - drupalorg_migrate_field_collection_supporting_organizations
dependencies:
enforced:
......
......@@ -25,10 +25,10 @@ process:
field_project_machine_name: field_project_machine_name
# field_project_images: field_project_images
# group_project_classification:
# field_module_categories:
# plugin: migration_lookup
# migration: drupalorg_migrate_module_categories
# source: taxonomy_vocabulary_3
# field_module_categories:
# plugin: migration_lookup
# migration: drupalorg_migrate_module_categories
# source: taxonomy_vocabulary_3
field_maintenance_status:
plugin: migration_lookup
migration: drupalorg_migrate_maintenance_status
......@@ -61,35 +61,35 @@ process:
# upload: upload
# group_project_documentation
# field_project_docs
# field_supporting_organizations:
# -
# plugin: sub_process
# source: field_supporting_organizations
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
# field_supporting_organizations:
# -
# plugin: sub_process
# source: field_supporting_organizations
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
uid:
plugin: migration_lookup
migration: drupalorg_migrate_users
......@@ -110,11 +110,11 @@ migration_dependencies:
required:
- drupalorg_migrate_development_status
- drupalorg_migrate_maintenance_status
# - drupalorg_migrate_module_categories
# - drupalorg_migrate_module_categories
# https://www.drupal.org/project/drupal/issues/2797505#comment-12129356
optional:
- drupalorg_migrate_users
# - drupalorg_migrate_field_collection_supporting_organizations
# - drupalorg_migrate_field_collection_supporting_organizations
dependencies:
enforced:
......
......@@ -25,10 +25,10 @@ process:
field_project_machine_name: field_project_machine_name
# field_project_images: field_project_images
# group_project_classification:
# field_module_categories:
# plugin: migration_lookup
# migration: drupalorg_migrate_module_categories
# source: taxonomy_vocabulary_3
# field_module_categories:
# plugin: migration_lookup
# migration: drupalorg_migrate_module_categories
# source: taxonomy_vocabulary_3
field_maintenance_status:
plugin: migration_lookup
migration: drupalorg_migrate_maintenance_status
......@@ -61,35 +61,35 @@ process:
# upload: upload
# group_project_documentation
# field_project_docs
# field_supporting_organizations:
# -
# plugin: sub_process
# source: field_supporting_organizations
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
# field_supporting_organizations:
# -
# plugin: sub_process
# source: field_supporting_organizations
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
uid:
plugin: migration_lookup
migration: drupalorg_migrate_users
......@@ -110,11 +110,11 @@ migration_dependencies:
required:
- drupalorg_migrate_development_status
- drupalorg_migrate_maintenance_status
# - drupalorg_migrate_module_categories
# - drupalorg_migrate_module_categories
# https://www.drupal.org/project/drupal/issues/2797505#comment-12129356
optional:
- drupalorg_migrate_users
# - drupalorg_migrate_field_collection_supporting_organizations
# - drupalorg_migrate_field_collection_supporting_organizations
dependencies:
enforced:
......
......@@ -71,35 +71,35 @@ process:
# upload: upload
# group_project_documentation
# field_project_docs
# field_supporting_organizations:
# -
# plugin: sub_process
# source: field_supporting_organizations
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
# field_supporting_organizations:
# -
# plugin: sub_process
# source: field_supporting_organizations
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
uid:
plugin: migration_lookup
migration: drupalorg_migrate_users
......@@ -125,7 +125,7 @@ migration_dependencies:
optional:
- drupalorg_migrate_users
- drupalorg_migrate_project_files
# - drupalorg_migrate_field_collection_supporting_organizations
# - drupalorg_migrate_field_collection_supporting_organizations
dependencies:
enforced:
......
......@@ -71,35 +71,35 @@ process:
# upload: upload
# group_project_documentation
# field_project_docs
# field_supporting_organizations:
# -
# plugin: sub_process
# source: field_supporting_organizations
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
# field_supporting_organizations:
# -
# plugin: sub_process
# source: field_supporting_organizations
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
uid:
plugin: migration_lookup
migration: drupalorg_migrate_users
......@@ -125,7 +125,7 @@ migration_dependencies:
optional:
- drupalorg_migrate_users
- drupalorg_migrate_project_files
# - drupalorg_migrate_field_collection_supporting_organizations
# - drupalorg_migrate_field_collection_supporting_organizations
dependencies:
enforced:
......
......@@ -47,35 +47,35 @@ process:
source: target_id
no_stub: true
field_release_category: field_release_category
# field_release_files:
# -
# plugin: sub_process
# source: field_release_files
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
# field_release_files:
# -
# plugin: sub_process
# source: field_release_files
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
field_release_build_type: field_release_build_type
field_release_short_description: field_release_short_description
field_show_download: field_show_download
......@@ -118,7 +118,7 @@ migration_dependencies:
# https://www.drupal.org/project/drupal/issues/2797505#comment-12129356
optional:
- drupalorg_migrate_users
# - drupalorg_migrate_field_collection_release_files
# - drupalorg_migrate_field_collection_release_files
dependencies:
enforced:
......
......@@ -25,10 +25,10 @@ process:
field_project_machine_name: field_project_machine_name
# field_project_images: field_project_images
# group_project_classification:
# field_module_categories:
# plugin: migration_lookup
# migration: drupalorg_migrate_module_categories
# source: taxonomy_vocabulary_3
# field_module_categories:
# plugin: migration_lookup
# migration: drupalorg_migrate_module_categories
# source: taxonomy_vocabulary_3
field_maintenance_status:
plugin: migration_lookup
migration: drupalorg_migrate_maintenance_status
......@@ -61,35 +61,35 @@ process:
# upload: upload
# group_project_documentation
# field_project_docs
# field_supporting_organizations:
# -
# plugin: sub_process
# source: field_supporting_organizations
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
# field_supporting_organizations:
# -
# plugin: sub_process
# source: field_supporting_organizations
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
uid:
plugin: migration_lookup
migration: drupalorg_migrate_users
......@@ -110,11 +110,11 @@ migration_dependencies:
required:
- drupalorg_migrate_development_status
- drupalorg_migrate_maintenance_status
# - drupalorg_migrate_module_categories
# - drupalorg_migrate_module_categories
# https://www.drupal.org/project/drupal/issues/2797505#comment-12129356
optional:
- drupalorg_migrate_users
# - drupalorg_migrate_field_collection_supporting_organizations
# - drupalorg_migrate_field_collection_supporting_organizations
dependencies:
enforced:
......
......@@ -25,10 +25,10 @@ process:
field_project_machine_name: field_project_machine_name
# field_project_images: field_project_images
# group_project_classification:
# field_module_categories:
# plugin: migration_lookup
# migration: drupalorg_migrate_module_categories
# source: taxonomy_vocabulary_3
# field_module_categories:
# plugin: migration_lookup
# migration: drupalorg_migrate_module_categories
# source: taxonomy_vocabulary_3
field_maintenance_status:
plugin: migration_lookup
migration: drupalorg_migrate_maintenance_status
......@@ -61,35 +61,35 @@ process:
# upload: upload
# group_project_documentation
# field_project_docs
# field_supporting_organizations:
# -
# plugin: sub_process
# source: field_supporting_organizations
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
# field_supporting_organizations:
# -
# plugin: sub_process
# source: field_supporting_organizations
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
uid:
plugin: migration_lookup
migration: drupalorg_migrate_users
......@@ -110,11 +110,11 @@ migration_dependencies:
required:
- drupalorg_migrate_development_status
- drupalorg_migrate_maintenance_status
# - drupalorg_migrate_module_categories
# - drupalorg_migrate_module_categories
# https://www.drupal.org/project/drupal/issues/2797505#comment-12129356
optional:
- drupalorg_migrate_users
# - drupalorg_migrate_field_collection_supporting_organizations
# - drupalorg_migrate_field_collection_supporting_organizations
dependencies:
enforced:
......
......@@ -25,10 +25,10 @@ process:
field_project_machine_name: field_project_machine_name
# field_project_images: field_project_images
# group_project_classification:
# field_module_categories:
# plugin: migration_lookup
# migration: drupalorg_migrate_module_categories
# source: taxonomy_vocabulary_3
# field_module_categories:
# plugin: migration_lookup
# migration: drupalorg_migrate_module_categories
# source: taxonomy_vocabulary_3
field_maintenance_status:
plugin: migration_lookup
migration: drupalorg_migrate_maintenance_status
......@@ -61,35 +61,35 @@ process:
# upload: upload
# group_project_documentation
# field_project_docs
# field_supporting_organizations:
# -
# plugin: sub_process
# source: field_supporting_organizations
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
# field_supporting_organizations:
# -
# plugin: sub_process
# source: field_supporting_organizations
# process:
# target_id:
# -
# plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# -
# plugin: extract
# index:
# - id
# target_revision_id:
# -
# plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# -
# plugin: extract
# index:
# - revision_id
uid:
plugin: migration_lookup
migration: drupalorg_migrate_users
......@@ -110,11 +110,11 @@ migration_dependencies:
required:
- drupalorg_migrate_development_status
- drupalorg_migrate_maintenance_status
# - drupalorg_migrate_module_categories
# - drupalorg_migrate_module_categories
# https://www.drupal.org/project/drupal/issues/2797505#comment-12129356
optional:
- drupalorg_migrate_users
# - drupalorg_migrate_field_collection_supporting_organizations
# - drupalorg_migrate_field_collection_supporting_organizations
dependencies:
enforced:
......
......@@ -15,18 +15,6 @@ destination:
process:
uid: uid
# name:
# -
# plugin: machine_name
# source: name
# -
# plugin: substr
# length: 60
# -
# plugin: make_unique_entity_field
# entity_type: user
# field: name
# postfix: _
name: name
pass: pass
mail: mail
......@@ -58,30 +46,30 @@ process:
field_last_name: field_last_name
field_demographics: field_demographics
field_country: field_country
# field_organizations:
# - plugin: sub_process
# source: field_organizations
# process:
# target_id:
# - plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# - plugin: extract
# index:
# - id
# target_revision_id:
# - plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# - plugin: extract
# index:
# - revision_id
# field_organizations:
# - plugin: sub_process
# source: field_organizations
# process:
# target_id:
# - plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# - plugin: extract
# index:
# - id
# target_revision_id:
# - plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# - plugin: extract
# index:
# - revision_id
user_picture:
plugin: migration_lookup
source: picture
......@@ -125,30 +113,30 @@ process:
field_user_comment_meta: field_user_comment_meta
field_terms_of_service: field_terms_of_service
field_da_ind_membership: field_da_ind_membership
# field_contribution_role:
# - plugin: sub_process
# source: field_contribution_role
# process:
# target_id:
# - plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# - plugin: extract
# index:
# - id
# target_revision_id:
# - plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# - plugin: extract
# index:
# - revision_id
# field_contribution_role:
# - plugin: sub_process
# source: field_contribution_role
# process:
# target_id:
# - plugin: paragraphs_lookup
# tags: 'Field Collection Content'
# source: value
# - plugin: extract
# index:
# - id
# target_revision_id:
# - plugin: paragraphs_lookup
# tags:
# - 'Field Collection Revisions Content'
# - 'Field Collection Content'
# tag_ids:
# 'Field Collection Revisions Content':
# - revision_id
# 'Field Collection Content':
# - value
# - plugin: extract
# index:
# - revision_id
field_fingerprint: field_fingerprint
field_reported_registration_ip: field_reported_registration_ip
field_events_attended: field_events_attended
......@@ -157,10 +145,10 @@ migration_dependencies:
required:
- drupalorg_migrate_user_roles
optional:
# - drupalorg_migrate_field_collection_organizations
# - drupalorg_migrate_field_collection_organizations
- drupalorg_migrate_areas_of_expertise
- drupalorg_migrate_user_picture_files
# - drupalorg_migrate_field_collection_contribution_role
# - drupalorg_migrate_field_collection_contribution_role
dependencies:
enforced:
......
......@@ -3,6 +3,7 @@
namespace Drupal\drupalorg_migrate\Commands;
use Drupal\Core\Database\Database;
use Drupal\Core\DependencyInjection\AutowireTrait;
use Drush\Commands\DrushCommands as BaseDrushCommands;
/**
......@@ -12,6 +13,12 @@ use Drush\Commands\DrushCommands as BaseDrushCommands;
*/
class DrushCommands extends BaseDrushCommands {
use AutowireTrait;
protected function __construct(protected Database $database) {
parent::__construct();
}
/**
* Check users deleted in D7 and not in D10.
*
......@@ -132,7 +139,7 @@ class DrushCommands extends BaseDrushCommands {
* Check which user ids are not in D7.
*
* @param array $uids
* List of user ids to check
* List of user ids to check.
*
* @return array
* Array of user ids not present in D7.
......
......@@ -22,7 +22,7 @@ class MemoryControlEventHandler implements EventSubscriberInterface {
public function __construct(
protected ConfigFactoryInterface $configFactory,
protected MemoryCacheInterface $memoryCache,
protected EntityTypeManagerInterface $entityTypeManager
protected EntityTypeManagerInterface $entityTypeManager,
) {}
/**
......@@ -44,12 +44,13 @@ class MemoryControlEventHandler implements EventSubscriberInterface {
$this->iterationCountUntilCacheFlush--;
if ($this->iterationCountUntilCacheFlush <= 0) {
// Temp debug.
dump(round(memory_get_usage()/1048576,2). ' MB');
dump(round(memory_get_usage() / 1048576, 2) . ' MB');
// $this->memoryCache->deleteAll();
// $this->configFactory->clearStaticCache();
// // Entity storage can blow up with caches so clear them out.
// foreach ($this->entityTypeManager->getDefinitions() as $id => $definition) {
// $this->entityTypeManager->getStorage($id)->resetCache();
// $definitions = $this->entityTypeManager->getDefinitions();
// foreach ($definitions as $id => $definition) {
// $this->entityTypeManager->getStorage($id)->resetCache();
// }
$this->iterationCountUntilCacheFlush = 1000;
}
......
......@@ -4,9 +4,7 @@ namespace Drupal\drupalorg_migrate\Plugin\migrate\process;
use Drupal\link\Plugin\migrate\process\FieldLink;
use Drupal\migrate\Attribute\MigrateProcess;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
/**
......
......@@ -2,6 +2,7 @@
namespace Drupal\drupalorg_migrate\Plugin\migrate\process;
use Drupal\Core\Database\Database;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
......@@ -21,7 +22,6 @@ use Drupal\migrate\Row;
* source: eid
* og_source_field: og_group_ref
* @endcode
*
*/
class GroupToReference extends ProcessPluginBase {
......@@ -29,9 +29,9 @@ class GroupToReference extends ProcessPluginBase {
* {@inheritdoc}
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
//Use the field name and the current entity id to get the group parent.
// Use the field name and the current entity id to get the group parent.
$og_source_field = $this->configuration['og_source_field'];
$db = \Drupal\Core\Database\Database::getConnection('default', 'migrate');
$db = Database::getConnection('default', 'migrate');
$query = $db->select('og_membership', 'ogm');
$query->condition('ogm.etid', $value);
$query->condition('ogm.field_name', $og_source_field);
......@@ -46,4 +46,5 @@ class GroupToReference extends ProcessPluginBase {
return $record['gid'];
}
}
......@@ -39,13 +39,14 @@ class DrupalOrgUser extends User {
// Removed all joinable + high-watermark code from the base plugin
// as we do not need it here. Only iterate on new/changed records.
// If we want to run a full migration:
// phpcs:ignore
// drush state:set drupalorg_migrate.drupalorg_migrate_users_last_record 0 --input-format=integer
$last_record = \Drupal::state()->get('drupalorg_migrate.drupalorg_migrate_users_last_record');
if (!is_null($last_record)) {
$this->query->condition('u.changed', $last_record, '>=');
$this->query->orderBy('u.changed');
}
// Set the time when the query was made in case we don't get any row processed.
// Set the time when the query was made.
\Drupal::state()->set('drupalorg_migrate.drupalorg_migrate_users_last_query', \Drupal::time()->getRequestTime());
}
......@@ -61,8 +62,9 @@ class DrupalOrgUser extends User {
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function next() {
// Timestamps from the last time the query was triggered and the last row processed.
// Timestamps from the last time the query was triggered and row processed.
$last_record = \Drupal::state()->get('drupalorg_migrate.drupalorg_migrate_users_last_record', 0);
$last_query = \Drupal::state()->get('drupalorg_migrate.drupalorg_migrate_users_last_query', 0);
......@@ -107,7 +109,7 @@ class DrupalOrgUser extends User {
}
}
// At this point, we've discarded all the rows that didn't need updating/creating.
// By now, we've discarded all the rows that didn't need updating/creating.
if (!is_null($this->currentRow)) {
// Set the new timestamp only when the record is going to be processed.
$row_changed = $this->currentRow->getSourceProperty('changed');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment