only in patch2: unchanged: --- a/core/lib/Drupal/Core/Config/StorageComparer.php +++ b/core/lib/Drupal/Core/Config/StorageComparer.php @@ -118,11 +118,16 @@ public function getChangelist($op = NULL) { * The change operation performed. Either delete, create or update. * @param array $changes * Array of changes to add to the changelist. + * @param array $sort_order + * Array to sort that can be used to sort the changelist. */ - protected function addChangeList($op, array $changes) { + protected function addChangeList($op, array $changes, array $sort_order = NULL) { // Only add changes that aren't already listed. $changes = array_diff($changes, $this->changelist[$op]); $this->changelist[$op] = array_merge($this->changelist[$op], $changes); + if (!empty($sort_order)) { + $this->changelist[$op] = array_intersect($sort_order, $this->changelist[$op]); + } } /** @@ -188,8 +193,9 @@ protected function addChangelistUpdate() { if (!empty($recreates)) { // Recreates should become deletes and creates. Deletes should be ordered // so that dependencies are deleted first. - $this->addChangeList('create', $recreates); - $this->addChangeList('delete', array_reverse($recreates)); + $this->addChangeList('create', $recreates, $this->sourceNames); + $this->addChangeList('delete', $recreates, array_reverse($this->targetNames)); + } }