From effc4663d23eb5f015592faec34b824d2907b6cf Mon Sep 17 00:00:00 2001 From: Blanca Esqueda Date: Tue, 13 Dec 2022 20:12:37 -0500 Subject: [PATCH] Revert "Add ability to compare revision dates for import updates" This reverts commit 758988f773a79684a8f28a770ba6c650f6e11761. --- src/Commands/ContentSyncCommands.php | 7 ++--- src/Content/ContentStorageComparer.php | 37 ++------------------------ 2 files changed, 4 insertions(+), 40 deletions(-) diff --git a/src/Commands/ContentSyncCommands.php b/src/Commands/ContentSyncCommands.php index 77fbb20..d16b6ef 100644 --- a/src/Commands/ContentSyncCommands.php +++ b/src/Commands/ContentSyncCommands.php @@ -204,8 +204,7 @@ public function import($label = NULL, array $options = [ 'entity-types' => '', 'uuids' => '', 'actions' => '', - 'skiplist' => FALSE, - 'compare-dates' ]) { + 'skiplist' => FALSE ]) { //Generate comparer with filters. $storage_comparer = new ContentStorageComparer($this->contentStorageSync, $this->contentStorage, $this->configManager); @@ -222,9 +221,7 @@ public function import($label = NULL, array $options = [ foreach ($collections as $collection){ if (!empty($options['uuids'])){ $storage_comparer->createChangelistbyCollectionAndNames($collection, $options['uuids']); - } elseif ($options['compare-dates']) { - $storage_comparer->createChangelistbyCollection($collection, TRUE); - } else { + }else{ $storage_comparer->createChangelistbyCollection($collection); } if (!empty($options['actions'])){ diff --git a/src/Content/ContentStorageComparer.php b/src/Content/ContentStorageComparer.php index 9519250..9c35e47 100644 --- a/src/Content/ContentStorageComparer.php +++ b/src/Content/ContentStorageComparer.php @@ -14,11 +14,11 @@ class ContentStorageComparer extends StorageComparer { /** * {@inheritdoc} */ - public function createChangelistbyCollection($collection, $use_dates = FALSE) { + public function createChangelistbyCollection($collection) { $this->changelist[$collection] = $this->getEmptyChangelist(); $this->getAndSortConfigData($collection); $this->addChangelistCreate($collection); - $use_dates ? $this->addChangelistUpdateByDate($collection) : $this->addChangelistUpdate($collection); + $this->addChangelistUpdate($collection); $this->addChangelistDelete($collection); // Only collections that support configuration entities can have renames. if ($collection == StorageInterface::DEFAULT_COLLECTION) { @@ -74,37 +74,4 @@ protected function getAndSortContentDataByCollectionAndNames($collection, $names } return false; } - - /** - * Creates the update changelist with revision date comparison. - * - * The list of updates is sorted so that dependencies are created before - * configuration entities that depend on them. For example, field storages - * should be updated before fields. - * - * @param string $collection - * The storage collection to operate on. - */ - protected function addChangelistUpdateByDate($collection) - { - $recreates = []; - foreach (array_intersect($this->sourceNames[$collection], $this->targetNames[$collection]) as $name) { - $source_data = $this->getSourceStorage($collection)->read($name); - $target_data = $this->getTargetStorage($collection)->read($name); - if ($source_data !== $target_data) { - if (isset($source_data['uuid']) && $source_data['uuid'] !== $target_data['uuid']) { - // The entity has the same file as an existing entity but the UUIDs do - // not match. This means that the entity has been recreated so config - // synchronization should do the same. - $recreates[] = $name; - } else { - if (strtotime($source_data['revision_timestamp'][count($source_data['revision_timestamp']) - 1]['value']) > - strtotime($target_data['revision_timestamp'][count($target_data['revision_timestamp']) - 1]['value'])) - { - $this->addChangeList($collection, 'update', [$name]); - } - } - } - } - } }