function features_set_signature in Features 7.2
Same name and namespace in other branches
- 6 features.export.inc \features_set_signature()
- 7 features.export.inc \features_set_signature()
Updates a module/component signature in the database.
The signature stored in the database reflects the last known state of the component in code.
Parameters
string $module: A feature module name.
string $component: A component name, e.g. 'field_instance'.
string|null|false $signature: An md5 signature, or NULL to generate one from the current state in code, or FALSE to delete the signature.
string|null $message: (optional) Message to store along with the updated signature.
4 calls to features_set_signature()
- features_admin_components_review in ./
features.admin.inc - Submit handler for the 'Mark as reviewed' button.
- features_get_component_states in ./
features.export.inc - Retrieve an array of features/components and their current states.
- features_update_6101 in ./
features.install - Update 6101: Set codestate signature for all features.
- _features_restore in ./
features.module - Restore the specified modules to the default state.
1 string reference to 'features_set_signature'
- features_update_6101 in ./
features.install - Update 6101: Set codestate signature for all features.
File
- ./
features.export.inc, line 968 - Contains functions that export configuration into feature modules.
Code
function features_set_signature($module, $component, $signature = NULL, $message = NULL) {
if ($signature === NULL) {
// Build signature from current state in code.
$signature = features_get_signature('default', $module, $component, TRUE);
}
// Support un-updated databases.
switch (_features_get_signature_storage_type()) {
case 'table':
// The database is fully updated.
// All signatures are stored in a dedicated database table.
if ($signature === FALSE) {
// Delete the signature.
db_delete('features_signature')
->condition('module', $module)
->condition('component', $component)
->execute();
}
else {
// Insert or update the signature.
db_merge('features_signature')
->key(array(
'module' => $module,
'component' => $component,
))
->fields(array(
'signature' => $signature,
'updated' => time(),
'message' => $message,
))
->execute();
}
break;
case 'cache':
// The database is not fully updated, only to schema version 7201.
// Signatures are stored in a cache table.
$cache = cache_get('features_codecache', 'cache_featurestate');
if (!empty($cache->data)) {
$signaturess = $cache->data;
}
$signaturess[$module][$component] = $signature;
cache_set('features_codecache', $signaturess, 'cache_featurestate');
break;
case 'variable':
default:
// The database is not fully updated, schema version before 7201.
// Signatures are stored in a variable.
$signaturess = variable_get('features_codecache', array());
$signaturess[$module][$component] = $signature;
variable_set('features_codecache', $signaturess);
break;
}
}