You are here

function drush_features_update_all in Features 7.2

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

Drush command callback for 'features-update-all'.

Updates all enabled features. Optionally a list of features can be passed in, to be excluded from update.

Return value

false|void FALSE on error, NULL/void otherwise.

File

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

Code

function drush_features_update_all() {
  $features_to_update = array();
  $features_to_exclude = func_get_args();
  foreach (features_get_features() as $module) {
    if ($module->status && !in_array($module->name, $features_to_exclude)) {
      $features_to_update[] = $module->name;
    }
  }
  $dt_args = array(
    '!modules' => implode(', ', $features_to_update),
  );
  drush_print(dt('The following modules will be updated: !modules', $dt_args));
  if (!drush_confirm(dt('Do you really want to continue?'))) {
    return drush_user_abort('Aborting.');
  }

  // If we got here, set affirmative to TRUE, so that the user doesn't have to
  // confirm each and every feature. Start off by storing the current value,
  // so we can set it back afteward.
  $skip_confirmation = drush_get_context('DRUSH_AFFIRMATIVE');
  drush_set_context('DRUSH_AFFIRMATIVE', TRUE);

  // Now update all the features.
  drush_invoke('features-update', $features_to_update);

  // Now set it back as it was, in case other commands are called after this.
  drush_set_context('DRUSH_AFFIRMATIVE', $skip_confirmation);
}