function features_semaphore in Features 6
Same name and namespace in other branches
- 7.2 features.export.inc \features_semaphore()
- 7 features.export.inc \features_semaphore()
Processing semaphore operations.
2 calls to features_semaphore()
- features_get_component_states in ./
features.export.inc - Retrieve an array of features/components and their current states.
- _features_restore in ./
features.module - Restore the specified modules to the default state.
1 string reference to 'features_semaphore'
- features_uninstall in ./
features.install - Implementation of hook_uninstall().
File
- ./
features.export.inc, line 557
Code
function features_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_result(db_query("SELECT value FROM {variable} WHERE name = 'features_semaphore'"));
$semaphore = !empty($semaphore) ? unserialize($semaphore) : array();
switch ($op) {
case 'get':
return isset($semaphore[$component]) ? $semaphore[$component] : FALSE;
case 'set':
$semaphore[$component] = time();
variable_set('features_semaphore', $semaphore);
break;
case 'del':
if (isset($semaphore[$component])) {
unset($semaphore[$component]);
variable_set('features_semaphore', $semaphore);
}
break;
}
}