You are here

public static function FeaturesHelper::revertAll in Helper 7

1 call to FeaturesHelper::revertAll()
FeaturesHelperTestCase::testRevert in tests/FeaturesHelperTestCase.test

File

lib/FeaturesHelper.php, line 33

Class

FeaturesHelper

Code

public static function revertAll($force = FALSE, array $features_to_exclude = array()) {
  module_load_include('inc', 'features', 'features.export');
  $modules = 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) {
        $modules[] = $module->name;
      }
      else {
        switch (features_get_storage($module->name)) {
          case FEATURES_OVERRIDDEN:
          case FEATURES_NEEDS_REVIEW:
          case FEATURES_REBUILDABLE:
            $modules[] = $module->name;
            break;
        }
      }
    }
  }
  if (!empty($modules)) {
    static::revert($modules, $force);
  }
}