diff -u b/core/includes/install.inc b/core/includes/install.inc --- b/core/includes/install.inc +++ b/core/includes/install.inc @@ -414,8 +414,7 @@ } config('system.module') ->set('system', 0) - ->setSorter('module_config_sort') - ->save(); + ->save('module_config_sort'); // Clear out module list and hook implementation statics before calling // system_rebuild_theme_data(). diff -u b/core/includes/module.inc b/core/includes/module.inc --- b/core/includes/module.inc +++ b/core/includes/module.inc @@ -467,8 +467,7 @@ if (!$enabled) { $config ->set($module, $weight) - ->setSorter('module_config_sort') - ->save(); + ->save('module_config_sort'); if ($weight) { $weight_store->delete($module_list); } @@ -592,8 +591,7 @@ } $config ->clear($module) - ->setSorter('module_config_sort') - ->save(); + ->save('module_config_sort'); $invoke_modules[] = $module; watchdog('system', '%module module disabled.', array('%module' => $module), WATCHDOG_INFO); } @@ -1153,8 +1151,7 @@ if ($config->get($module) !== NULL) { $config ->set($module, $weight) - ->setSorter('module_config_sort') - ->save(); + ->save('module_config_sort'); } else { KeyValueFactory::get('system.module.weight')->set($module, $weight); diff -u b/core/includes/update.inc b/core/includes/update.inc --- b/core/includes/update.inc +++ b/core/includes/update.inc @@ -38,9 +38,11 @@ } if ($save) { if ($type == 'module') { - $config->setSorter('module_config_sort'); + $config->save('module_config_sort'); + } + else { + $config->save(); } - $config->save(); } } } @@ -201,10 +203,8 @@ } } } - $configs['module']->setSorter('module_config_sort'); - foreach ($configs as $config) { - $config->save(); - } + $configs['module']->save('module_config_sort'); + $configs['theme']->save(); // Update the dynamic include paths that might be used before running the // proper update functions. @@ -406,8 +406,7 @@ // Enable the module with a weight of 0. config('system.module') ->set($module, 0) - ->setSorter('module_config_sort') - ->save(); + ->save('module_config_sort'); // Change the schema version from SCHEMA_UNINSTALLED to 0, so any module // updates since the module's inception are executed in a core upgrade. $store->set($module, 0); diff -u b/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php --- b/core/lib/Drupal/Core/Config/Config.php +++ b/core/lib/Drupal/Core/Config/Config.php @@ -65,20 +65,6 @@ protected $eventDispatcher; /** - * TRUE if the configuration object does not need sorting on save. - * - * @var bool - */ - protected $sorted = FALSE; - - /** - * The callable that sorts the data before save. - * - * @var callable - */ - protected $sorter; - - /** * Constructs a configuration object. * * @param string $name @@ -323,20 +309,14 @@ /** * Saves the configuration object. */ - public function save() { - if (!$this->sorted) { - call_user_func($this->sorter ? $this->sorter : array($this, 'sortByKey'), $this->data); - } + public function save($sorter = FALSE) { + $this->data = call_user_func($sorter ? $sorter : array($this, 'sortByKey'), $this->data); $this->storage->write($this->name, $this->data); $this->isNew = FALSE; $this->notify('save'); return $this; } - public function sorted() { - $this->sorted = TRUE; - } - /* * Renames the configuration object. * @@ -351,14 +331,6 @@ } /** - * @param callable - */ - function setSorter($sorter) { - $this->sorter = $sorter; - return $this; - } - - /** * Sorts all keys in configuration data. * * Ensures that re-inserted keys appear in the same location as before, in