Loading core/lib/Drupal/Core/Config/MemoryStorage.php +8 −1 Changes for core/lib/Drupal/Core/Config/MemoryStorage.php: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -56,7 +56,14 @@ public function read($name) { * {@inheritdoc} */ public function readMultiple(array $names) { return array_intersect_key($this->config[$this->collection], array_flip($names)); $items = []; foreach ($names as $name) { $value = $this->read($name); if (!empty($value)) { $items[$name] = $value; } } return $items; } /** Loading core/lib/Drupal/Core/Config/StorageCopyTrait.php +11 −5 Changes for core/lib/Drupal/Core/Config/StorageCopyTrait.php: 11 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -34,13 +34,18 @@ protected static function replaceStorageContents(StorageInterface $source, Stora foreach (array_diff($target_collection->listAll(), $names) as $name) { $target_collection->delete($name); } // Load the config in chunks of 500 items to conserve peak memory. foreach (array_chunk($names, 500) as $chunked_names) { // Then we loop over the config which needs to be there. foreach ($names as $name) { $data = $source_collection->read($name); if ($data !== FALSE) { if ($target_collection->read($name) !== $data) { $source_data = $source_collection->readMultiple($chunked_names); $target_data = $target_collection->readMultiple($chunked_names); foreach ($chunked_names as $name) { if (isset($source_data[$name])) { if (!isset($target_data[$name]) || ($target_data[$name] !== $source_data[$name])) { // Update the target collection if the data is different. $target_collection->write($name, $data); $target_collection->write($name, $source_data[$name]); } } else { Loading @@ -51,6 +56,7 @@ protected static function replaceStorageContents(StorageInterface $source, Stora } } } } // Make sure that the target is set to the same collection as the source. $target = $target->createCollection($source->getCollectionName()); Loading Loading
core/lib/Drupal/Core/Config/MemoryStorage.php +8 −1 Changes for core/lib/Drupal/Core/Config/MemoryStorage.php: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -56,7 +56,14 @@ public function read($name) { * {@inheritdoc} */ public function readMultiple(array $names) { return array_intersect_key($this->config[$this->collection], array_flip($names)); $items = []; foreach ($names as $name) { $value = $this->read($name); if (!empty($value)) { $items[$name] = $value; } } return $items; } /** Loading
core/lib/Drupal/Core/Config/StorageCopyTrait.php +11 −5 Changes for core/lib/Drupal/Core/Config/StorageCopyTrait.php: 11 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -34,13 +34,18 @@ protected static function replaceStorageContents(StorageInterface $source, Stora foreach (array_diff($target_collection->listAll(), $names) as $name) { $target_collection->delete($name); } // Load the config in chunks of 500 items to conserve peak memory. foreach (array_chunk($names, 500) as $chunked_names) { // Then we loop over the config which needs to be there. foreach ($names as $name) { $data = $source_collection->read($name); if ($data !== FALSE) { if ($target_collection->read($name) !== $data) { $source_data = $source_collection->readMultiple($chunked_names); $target_data = $target_collection->readMultiple($chunked_names); foreach ($chunked_names as $name) { if (isset($source_data[$name])) { if (!isset($target_data[$name]) || ($target_data[$name] !== $source_data[$name])) { // Update the target collection if the data is different. $target_collection->write($name, $data); $target_collection->write($name, $source_data[$name]); } } else { Loading @@ -51,6 +56,7 @@ protected static function replaceStorageContents(StorageInterface $source, Stora } } } } // Make sure that the target is set to the same collection as the source. $target = $target->createCollection($source->getCollectionName()); Loading