diff -u b/core/lib/Drupal/Core/Config/StorageComparer.php b/core/lib/Drupal/Core/Config/StorageComparer.php --- b/core/lib/Drupal/Core/Config/StorageComparer.php +++ b/core/lib/Drupal/Core/Config/StorageComparer.php @@ -35,14 +35,14 @@ protected $changelist; /** - * Lists all the configuration object names in the source storage. + * Sorted list of all the configuration object names in the source storage. * * @var array */ protected $sourceNames = array(); /** - * Lists all the configuration object names in the target storage. + * Sorted list of all the configuration object names in the target storage. * * @var array */ @@ -129,7 +129,7 @@ * {@inheritdoc} */ public function createChangelist() { - $this->setUpData(); + $this->getAndSortConfigData(); $this->addChangelistCreate(); $this->addChangelistUpdate(); $this->addChangelistDelete(); @@ -140,36 +140,36 @@ /** * Creates the delete changelist. + * + * The list of deletes is sorted so that dependencies are deleted after + * configuration entities that depend on them. For example, field instances + * should be deleted before fields. */ protected function addChangelistDelete() { - // Sort deletes in such a way that dependencies are deleted after - // configuration entities that depend on them. For example, field instances - // should be deleted before fields and fields should be deleted before - // content types. $deletes = array_diff(array_reverse($this->targetNames), $this->sourceNames); $this->addChangeList('delete', $deletes); } /** * Creates the create changelist. + * + * The list of creates is sorted so that dependencies are created before + * configuration entities that depend on them. For example, field instances + * should be created after fields. */ protected function addChangelistCreate() { - // Organise creates in such a way that dependencies are created before - // configuration entities that depend on them. For example, field instances - // should be created after fields and fields should be created after - // content types. $creates = array_diff($this->sourceNames, $this->targetNames); $this->addChangeList('create', $creates); } /** * Creates the update changelist. + * + * The list of updates is sorted so that dependencies are created before + * configuration entities that depend on them. For example, field instances + * should be created after fields. */ protected function addChangelistUpdate() { - // Organise updates in such a way that dependencies are updated before - // configuration entities that depend on them. For example, field instances - // should be updated after fields and fields should be updated after - // content types. foreach (array_intersect($this->sourceNames, $this->targetNames) as $name) { if ($this->sourceData[$name] !== $this->targetData[$name]) { $this->addChangeList('update', array($name)); @@ -208,9 +208,9 @@ } /** - * Sets up the data required to determine and sort the change lists. + * Gets and sorts configuration data from the source and target storages. */ - protected function setUpData() { + protected function getAndSortConfigData() { $this->targetData = $this->targetStorage->readMultiple($this->targetStorage->listAll()); $this->sourceData = $this->sourceStorage->readMultiple($this->sourceStorage->listAll()); $dependency_manager = new ConfigDependencyManager();