1 config.admin.inc | config_get_statuses() |
Utility function to get the current diffs between active and staging.
File
- core/
modules/ config/ config.admin.inc, line 496 - Admin page callbacks for the Configuration Management module.
Code
function config_get_statuses() {
$active_storage = config_get_config_storage('active');
$staging_storage = config_get_config_storage('staging');
// Create full list of all files from both active and staging.
$active_files = $active_storage->listAll();
$staging_files = $staging_storage->listAll();
$all_files = array_unique(array_merge($active_files, $staging_files));
$all_files = array_combine($all_files, array_fill(0, count($all_files), NULL));
$config_statuses = $all_files;
if ($staging_files) {
if ($delete_diffs = array_diff($active_files, $staging_files)) {
foreach ($delete_diffs as $filename) {
$config_statuses[$filename] = 'delete';
}
}
if ($create_diffs = array_diff($staging_files, $active_files)) {
foreach ($create_diffs as $filename) {
$config_statuses[$filename] = 'create';
}
}
if ($remaining_diffs = array_diff($active_files, $delete_diffs)) {
foreach ($remaining_diffs as $filename) {
try {
$active_config = $active_storage->read($filename);
$staging_config = $staging_storage->read($filename);
if ($active_config !== $staging_config) {
$config_statuses[$filename] = 'update';
}
}
catch (ConfigStorageReadException $e) {
$config_statuses[$filename] = 'error';
}
}
}
}
ksort($config_statuses);
return $config_statuses;
}