You are here

function uuid_features_command_update_files in UUID Features Integration 6

Same name and namespace in other branches
  1. 7 includes/uuid_features.drush.inc \uuid_features_command_update_files()

Update files for features modules that use the uuid_file component.

1 string reference to 'uuid_features_command_update_files'
uuid_features_drush_command in includes/uuid_features.drush.inc
Implementation of hook_drush_command().

File

includes/uuid_features.drush.inc, line 45
uuid_features module drush integration.

Code

function uuid_features_command_update_files($feature = NULL) {
  if ($args = func_get_args()) {
    foreach ($args as $module) {
      if (($feature = feature_load($module, TRUE)) && module_exists($module)) {
        if (!empty($feature->info['features']['uuid_file'])) {
          $files = $feature->info['features']['uuid_file'];
          $dest = drupal_get_path('module', $module) . '/uuid_file';
          file_check_directory($dest, FILE_CREATE_DIRECTORY);
          foreach ($files as $uuid) {
            _uuid_features_drush_update_file($module, $uuid);
          }
        }
      }
      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);
  }
}