Created
November 13, 2013 00:03
-
-
Save ethanhinson/7441065 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Revert specified features. | |
* | |
* @TODO Check that it really is Forced features revert. Currently an exact | |
* copy of the function initially placed in feature_projects.install. | |
* | |
* Code mostly taken from drush. | |
*/ | |
function vrweb_base_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