Mercurial > hg > isophonics-drupal-site
comparison core/modules/migrate/src/Plugin/MigrationPluginManager.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
58 $this->setCacheBackend($cache_backend, 'migration_plugins', ['migration_plugins']); | 58 $this->setCacheBackend($cache_backend, 'migration_plugins', ['migration_plugins']); |
59 $this->moduleHandler = $module_handler; | 59 $this->moduleHandler = $module_handler; |
60 } | 60 } |
61 | 61 |
62 /** | 62 /** |
63 * {@inheritdoc} | 63 * Gets the plugin discovery. |
64 * | |
65 * This method overrides DefaultPluginManager::getDiscovery() in order to | |
66 * search for migration configurations in the MODULENAME/migrations and | |
67 * MODULENAME/migration_templates directories. Throws a deprecation notice if | |
68 * the MODULENAME/migration_templates directory exists. | |
64 */ | 69 */ |
65 protected function getDiscovery() { | 70 protected function getDiscovery() { |
66 if (!isset($this->discovery)) { | 71 if (!isset($this->discovery)) { |
67 $directories = array_map(function ($directory) { | 72 $directories = array_map(function ($directory) { |
73 // Check for use of the @deprecated /migration_templates directory. | |
74 // @todo Remove use of /migration_templates in Drupal 9.0.0. | |
75 if (is_dir($directory . '/migration_templates')) { | |
76 @trigger_error('Use of the /migration_templates directory to store migration configuration files is deprecated in Drupal 8.1.0 and will be removed before Drupal 9.0.0. See https://www.drupal.org/node/2920988.', E_USER_DEPRECATED); | |
77 } | |
78 // But still accept configurations found in /migration_templates. | |
68 return [$directory . '/migration_templates', $directory . '/migrations']; | 79 return [$directory . '/migration_templates', $directory . '/migrations']; |
69 }, $this->moduleHandler->getModuleDirectories()); | 80 }, $this->moduleHandler->getModuleDirectories()); |
70 | 81 |
71 $yaml_discovery = new YamlDirectoryDiscovery($directories, 'migrate'); | 82 $yaml_discovery = new YamlDirectoryDiscovery($directories, 'migrate'); |
72 // This gets rid of migrations which try to use a non-existent source | 83 // This gets rid of migrations which try to use a non-existent source |
114 // Sort the migrations based on their dependencies. | 125 // Sort the migrations based on their dependencies. |
115 return $this->buildDependencyMigration($instances, []); | 126 return $this->buildDependencyMigration($instances, []); |
116 } | 127 } |
117 | 128 |
118 /** | 129 /** |
119 * Create migrations given a tag. | 130 * {@inheritdoc} |
120 * | |
121 * @param string $tag | |
122 * A migration tag we want to filter by. | |
123 * | |
124 * @return array|\Drupal\migrate\Plugin\MigrationInterface[] | |
125 * An array of migration objects with the given tag. | |
126 */ | 131 */ |
127 public function createInstancesByTag($tag) { | 132 public function createInstancesByTag($tag) { |
128 $migrations = array_filter($this->getDefinitions(), function ($migration) use ($tag) { | 133 $migrations = array_filter($this->getDefinitions(), function ($migration) use ($tag) { |
129 return !empty($migration['migration_tags']) && in_array($tag, $migration['migration_tags']); | 134 return !empty($migration['migration_tags']) && in_array($tag, $migration['migration_tags']); |
130 }); | 135 }); |