X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fmigrate%2Fsrc%2FPlugin%2FMigration.php;h=20b8ae877b9033cd8f6d314b20d467b9dc05b959;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=3bbe38ad7425cad92f7d8a57bc5f6913f1fd6483;hpb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;p=yaffs-website diff --git a/web/core/modules/migrate/src/Plugin/Migration.php b/web/core/modules/migrate/src/Plugin/Migration.php index 3bbe38ad7..20b8ae877 100644 --- a/web/core/modules/migrate/src/Plugin/Migration.php +++ b/web/core/modules/migrate/src/Plugin/Migration.php @@ -154,6 +154,17 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn */ protected $migration_tags = []; + /** + * Whether the migration is auditable. + * + * If set to TRUE, the migration's IDs will be audited. This means that, if + * the highest destination ID is greater than the highest source ID, a warning + * will be displayed that entities might be overwritten. + * + * @var bool + */ + protected $audit = FALSE; + /** * These migrations, if run, must be executed before this migration. * @@ -205,7 +216,7 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn protected $sourcePluginManager; /** - * Thep process plugin manager. + * The process plugin manager. * * @var \Drupal\migrate\Plugin\MigratePluginManager */ @@ -399,7 +410,7 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn */ public function getDestinationPlugin($stub_being_requested = FALSE) { if ($stub_being_requested && !empty($this->destination['no_stub'])) { - throw new MigrateSkipRowException(); + throw new MigrateSkipRowException('Stub requested but not made because no_stub configuration is set.'); } if (!isset($this->destinationPlugin)) { $this->destinationPlugin = $this->destinationPluginManager->createInstance($this->destination['plugin'], $this->destination, $this); @@ -543,7 +554,6 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn return $this; } - /** * {@inheritdoc} */ @@ -609,19 +619,22 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn } /** - * Find migration dependencies from the migration and the iterator plugins. + * Find migration dependencies from migration_lookup and sub_process plugins. + * + * @param array $process + * A process configuration array. * - * @param $process * @return array + * The migration dependencies. */ protected function findMigrationDependencies($process) { $return = []; foreach ($this->getProcessNormalized($process) as $process_pipeline) { foreach ($process_pipeline as $plugin_configuration) { - if ($plugin_configuration['plugin'] == 'migration') { + if (in_array($plugin_configuration['plugin'], ['migration', 'migration_lookup'], TRUE)) { $return = array_merge($return, (array) $plugin_configuration['migration']); } - if ($plugin_configuration['plugin'] == 'sub_process') { + if (in_array($plugin_configuration['plugin'], ['iterator', 'sub_process'], TRUE)) { $return = array_merge($return, $this->findMigrationDependencies($plugin_configuration['process'])); } } @@ -677,4 +690,11 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn return $this->migration_tags; } + /** + * {@inheritdoc} + */ + public function isAuditable() { + return (bool) $this->audit; + } + }