You are here

function drush_features_update in Features 6

Same name and namespace in other branches
  1. 7.2 features.drush.inc \drush_features_update()
  2. 7 features.drush.inc \drush_features_update()

Update an existing feature module.

File

./features.drush.inc, line 360
Features module drush integration.

Code

function drush_features_update() {
  if ($args = func_get_args()) {
    foreach ($args as $module) {
      if (($feature = feature_load($module, TRUE)) && module_exists($module)) {
        _drush_features_export($feature->info['features'], $feature->info['dependencies'], $feature->name, dirname($feature->filename));
      }
      else {
        if ($feature) {
          _features_drush_set_error($module, 'FEATURES_FEATURE_NOT_ENABLED');
        }
        else {
          _features_drush_set_error($module);
        }
      }
    }
  }
  else {

    // By default just show contexts that are available.
    $rows = array(
      array(
        dt('Available features'),
      ),
    );
    foreach (features_get_features(NULL, TRUE) as $name => $info) {
      $rows[] = array(
        $name,
      );
    }
    drush_print_table($rows, TRUE);
  }
}