Mercurial > hg > isophonics-drupal-site
comparison core/modules/migrate/src/Plugin/MigrationPluginManager.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
81 | 81 |
82 $yaml_discovery = new YamlDirectoryDiscovery($directories, 'migrate'); | 82 $yaml_discovery = new YamlDirectoryDiscovery($directories, 'migrate'); |
83 // 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 |
84 // plugin. The common case for this is if the source plugin has, or | 84 // plugin. The common case for this is if the source plugin has, or |
85 // specifies, a non-existent provider. | 85 // specifies, a non-existent provider. |
86 $only_with_source_discovery = new NoSourcePluginDecorator($yaml_discovery); | 86 $only_with_source_discovery = new NoSourcePluginDecorator($yaml_discovery); |
87 // This gets rid of migrations with explicit providers set if one of the | 87 // This gets rid of migrations with explicit providers set if one of the |
88 // providers do not exist before we try to use a potentially non-existing | 88 // providers do not exist before we try to use a potentially non-existing |
89 // deriver. This is a rare case. | 89 // deriver. This is a rare case. |
90 $filtered_discovery = new ProviderFilterDecorator($only_with_source_discovery, [$this->moduleHandler, 'moduleExists']); | 90 $filtered_discovery = new ProviderFilterDecorator($only_with_source_discovery, [$this->moduleHandler, 'moduleExists']); |
91 $this->discovery = new ContainerDerivativeDiscoveryDecorator($filtered_discovery); | 91 $this->discovery = new ContainerDerivativeDiscoveryDecorator($filtered_discovery); |
157 $plugin_ids[] = $id; | 157 $plugin_ids[] = $id; |
158 } | 158 } |
159 } | 159 } |
160 return $plugin_ids; | 160 return $plugin_ids; |
161 } | 161 } |
162 | |
163 | 162 |
164 /** | 163 /** |
165 * {@inheritdoc} | 164 * {@inheritdoc} |
166 */ | 165 */ |
167 public function buildDependencyMigration(array $migrations, array $dynamic_ids) { | 166 public function buildDependencyMigration(array $migrations, array $dynamic_ids) { |
207 $weights[] = $dependency_graph[$migration_id]['weight']; | 206 $weights[] = $dependency_graph[$migration_id]['weight']; |
208 if (!empty($required_dependency_graph[$migration_id]['paths'])) { | 207 if (!empty($required_dependency_graph[$migration_id]['paths'])) { |
209 $migration->set('requirements', $required_dependency_graph[$migration_id]['paths']); | 208 $migration->set('requirements', $required_dependency_graph[$migration_id]['paths']); |
210 } | 209 } |
211 } | 210 } |
212 array_multisort($weights, SORT_DESC, SORT_NUMERIC, $migrations); | 211 // Sort weights, labels, and keys in the same order as each other. |
212 array_multisort( | |
213 // Use the numerical weight as the primary sort. | |
214 $weights, SORT_DESC, SORT_NUMERIC, | |
215 // When migrations have the same weight, sort them alphabetically by ID. | |
216 array_keys($migrations), SORT_ASC, SORT_NATURAL, | |
217 $migrations | |
218 ); | |
213 | 219 |
214 return $migrations; | 220 return $migrations; |
215 } | 221 } |
216 | 222 |
217 /** | 223 /** |