function configuration_semaphore in Configuration Management 7
Processing semaphore operations.
2 calls to configuration_semaphore()
- configuration_get_component_states in ./
configuration.export.inc - Retrieve an array of configuration/components and their current states.
- _configuration_restore in ./
configuration.module - Restore the specified modules to the default state.
File
- ./
configuration.export.inc, line 462
Code
function configuration_semaphore($op, $component) {
// Note: we don't use variable_get() here as the inited variable
// static cache may be stale. Retrieving directly from the DB narrows
// the possibility of collision.
$semaphore = db_query("SELECT value FROM {variable} WHERE name = :name", array(
':name' => 'configuration_semaphore',
))
->fetchField();
$semaphore = !empty($semaphore) ? unserialize($semaphore) : array();
switch ($op) {
case 'get':
return isset($semaphore[$component]) ? $semaphore[$component] : FALSE;
case 'set':
$semaphore[$component] = REQUEST_TIME;
variable_set('configuration_semaphore', $semaphore);
break;
case 'del':
if (isset($semaphore[$component])) {
unset($semaphore[$component]);
variable_set('configuration_semaphore', $semaphore);
}
break;
}
}