Skip to content

Instantly share code, notes, and snippets.

@mrfelton
Created July 11, 2012 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrfelton/3090527 to your computer and use it in GitHub Desktop.
Save mrfelton/3090527 to your computer and use it in GitHub Desktop.
/**
* Revert specified features.
*/
function cw_core_features_revert($modules) {
module_load_include('inc', 'features', 'features.export');
features_include();
foreach ($modules as $module) {
if (($feature = feature_load($module, TRUE)) && module_exists($module)) {
$components = array();
// Forcefully revert all components of a feature.
foreach (array_keys($feature->info['features']) as $component) {
if (features_hook($component, 'features_revert')) {
$components[] = $component;
}
}
}
foreach ($components as $component) {
features_revert(array($module => array($component)));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment