function configuration_check_menu_custom in Configuration Management 7
1 call to configuration_check_menu_custom()
- configuration_menu_update in observers/
observer.menu.inc - Implements hook_menu_update().
File
- includes/
configuration.menu.inc, line 358
Code
function configuration_check_menu_custom($identifier, $from_activestore = FALSE) {
// Get static variable that we can access across this request.
$from_activestore =& drupal_static('configuration_from_activestore');
$component = 'menu_custom';
if (file_exists("config://configuration.menu_custom.inc")) {
// Load the current configuration file on disk
include_once drupal_realpath("config://configuration.menu_custom.inc");
// Export just the field we're tracking.
module_load_include('inc', 'configuration', 'configuration.export');
// Export the field we just saved and evaluate the export to $fields
$code = menu_custom_configuration_export_render('configuration', array(
$identifier,
));
eval(array_pop($code));
$menus_code = configuration_menu_default_menu_custom();
// If the activestore doesn't exist it is most likely because this configuration
// only exists in code.
if (empty($menus)) {
configuration_set_status($component, $identifier, CONFIGURATION_TRACKED_DATASTORE_ONLY);
}
// If this was the previous configuration in activestore don't mark this as changed.
$config = configuration_get_configuration();
/**
* @todo This code is reused in all component files.
*/
$return = '';
$component = 'menu_custom';
$status = $config[$component][$identifier]['status'];
$md5_datastore = is_array($menus_code) && array_key_exists($identifier, $menus_code) ? md5(serialize($menus_code[$identifier])) : '';
$md5_activestore = is_array($menus_code) && array_key_exists($identifier, $menus_code) ? md5(serialize($menus[$identifier])) : '';
// Configs in code are not the same as what was just saved in activestore.
if ($from_activestore == TRUE && $md5_datastore != $md5_activestore) {
$status = $status | CONFIGURATION_ACTIVESTORE_OVERRIDDEN;
configuration_set_status($component, $identifier, $status);
}
// Menu in the activestore is the same as what is in code.
if ($md5_activestore == $md5_datastore) {
$status = CONFIGURATION_IN_SYNC;
configuration_set_status($component, $identifier, $status);
configuration_set_hash($component, $identifier, $md5_activestore);
}
if ($md5_activestore != $md5_datastore) {
$status = $status | CONFIGURATION_DATASTORE_OVERRIDDEN;
configuration_set_status($component, $identifier, $status);
}
// When checking for new configurations, check to see if configurations are
// the same in datastore as last activestore. Remove the datastore overridden.
if ($md5_datastore == $config[$component][$identifier]['hash']) {
$status = $status & ~CONFIGURATION_DATASTORE_OVERRIDDEN;
configuration_set_status($component, $identifier, $status);
}
// Store the config array in cache for easy access
if ($status != CONFIGURATION_IN_SYNC) {
$configuration[$component][$identifier]['activestore'] = is_array($menus_code) && array_key_exists($identifier, $menus_code) ? $menus[$identifier] : '';
$configuration[$component][$identifier]['datastore'] = is_array($menus_code) && array_key_exists($identifier, $menus_code) ? $menus_code[$identifier] : '';
cache_set("{$component}:{$identifier}", $configuration, 'cache_configuration');
}
}
}