diff --git a/core/includes/config.inc b/core/includes/config.inc index 26f4b6f..c143dd4 100644 --- a/core/includes/config.inc +++ b/core/includes/config.inc @@ -91,13 +91,13 @@ function config_sync_get_changes(StorageInterface $source_storage, StorageInterf foreach (array_intersect($source_names, $target_names) as $name) { $source_config_data = $source_storage->read($name); $target_config_data = $target_storage->read($name); - if ($source_config_data != $target_config_data) { + if ($source_config_data !== $target_config_data) { $config_changes['change'][] = $name; } } // Do not trigger subsequent synchronization operations if there are no - // changes in either category. + // changes in any category. if (empty($config_changes['create']) && empty($config_changes['change']) && empty($config_changes['delete'])) { return FALSE; } @@ -130,6 +130,10 @@ function config_sync_changes(array $config_changes, StorageInterface $source_sto /** * Imports configuration from FileStorage to DatabaseStorage. + * + * @return bool|null + * TRUE if configuration was imported successfully, FALSE in case of a + * synchronization error, or NULL if there are no changes to synchronize. */ function config_import() { // Retrieve a list of differences between FileStorage and DatabaseStorage. @@ -144,14 +148,14 @@ function config_import() { if (!lock_acquire(__FUNCTION__)) { // Another request is synchronizing configuration. - // Return a negative result for UI purposes. We do not make a difference - // between an actual synchronization error and a failed lock, because a - // concurrent request synchronizing configuration is an edge-case in the - // first place and would mean that more than one developer or site builder - // attempts to do it without coordinating with others. + // Return a negative result for UI purposes. We do not differentiate between + // an actual synchronization error and a failed lock, because concurrent + // synchronizations are an edge-case happening only when multiple developers + // or site builders attempt to do it without coordinating. return FALSE; } + $success = TRUE; try { $remaining_changes = config_import_invoke_owner($config_changes, $source_storage, $target_storage); config_sync_changes($remaining_changes, $source_storage, $target_storage); @@ -160,11 +164,10 @@ function config_import() { } catch (ConfigException $e) { watchdog_exception('config_import', $e); - lock_release(__FUNCTION__); - return FALSE; + $success = FALSE; } lock_release(__FUNCTION__); - return TRUE; + return $success; } /**