function uuid_file_features_rebuild in UUID Features Integration 7
Same name and namespace in other branches
- 6 includes/uuid_file.features.inc \uuid_file_features_rebuild()
Implements hook_features_rebuild().
Rebuilds files based on UUID from code defaults.
1 call to uuid_file_features_rebuild()
- uuid_file_features_revert in includes/
uuid_file.features.inc - Implements hook_features_revert().
File
- includes/
uuid_file.features.inc, line 68 - Features hooks for the uuid_file features component.
Code
function uuid_file_features_rebuild($module) {
$files = features_get_default('uuid_file', $module);
if (!empty($files)) {
$source_dir = drupal_get_path('module', $module) . '/uuid_file';
foreach ($files as $data) {
$source = $source_dir . '/' . $data['uuid'] . '.' . $data['extension'];
$data = file_get_contents($source);
// Copy the file and save to db.
$file = file_save_data($data, NULL, FILE_EXISTS_REPLACE);
}
}
}