function drush_features_revert_all in Features 6
Same name and namespace in other branches
- 7.2 features.drush.inc \drush_features_revert_all()
- 7 features.drush.inc \drush_features_revert_all()
Revert all enabled features to their definitions in code.
Parameters
...: (Optional) A list of features to exclude from being reverted.
File
- ./
features.drush.inc, line 520 - Features module drush integration.
Code
function drush_features_revert_all() {
module_load_include('inc', 'features', 'features.export');
$force = drush_get_option('force');
$features_to_exclude = func_get_args();
$features_to_revert = array();
foreach (features_get_features(NULL, TRUE) as $module) {
if ($module->status && !in_array($module->name, $features_to_exclude)) {
// If forced, add module regardless of status.
if ($force) {
$features_to_revert[] = $module->name;
}
else {
switch (features_get_storage($module->name)) {
case FEATURES_OVERRIDDEN:
case FEATURES_NEEDS_REVIEW:
case FEATURES_REBUILDABLE:
$features_to_revert[] = $module->name;
break;
}
}
}
}
if ($features_to_revert) {
drush_print(dt('The following modules will be reverted: !modules', array(
'!modules' => implode(', ', $features_to_revert),
)));
if (drush_confirm(dt('Do you really want to continue?'))) {
foreach ($features_to_revert as $module) {
drush_invoke_process(drush_sitealias_get_record('@self'), 'features-revert', array(
$module,
), array(
'force' => $force,
'#integrate' => TRUE,
));
}
}
else {
drush_die('Aborting.');
}
}
else {
drush_log(dt('Current state already matches defaults, aborting.'), 'ok');
}
}