You are here

function drush_quickupdate_qup_download_missing_dependencies in Quick update 7

Command handler. Downloads missing dependency projects.

File

./quickupdate.drush.inc, line 70
Drush integration for the Quick update module.

Code

function drush_quickupdate_qup_download_missing_dependencies() {
  $projects_arr = array();
  if (func_num_args() > 0) {
    $projects_arr = func_get_args();
    $projects_str = implode(',', $projects_arr);
    $projects_arr = explode(',', $projects_str);
  }
  $dependencies = quickupdate_load_missing_dependencies($projects_arr);
  $count = count($dependencies);
  if ($count > 0) {
    foreach ($dependencies as $short_name => $item) {
      drush_print("\n");
      drush_print(dt('Downloading dependency !projects of project !required_by...', array(
        '!projects' => format_plural($count, 'project', 'projects'),
        '!required_by' => $item['required_by'],
      )));
      drush_print(dt('-------------------------------------------------------------'));
      $args = array_merge(array(
        'pm-download',
      ), array(
        $short_name,
      ));
      call_user_func_array('drush_invoke', $args);

      // Reloads to check if there are more missing dependency projects.
      // If so, downloads them.
      $dependencies = quickupdate_load_missing_dependencies(array(
        $short_name,
      ));
      $count = count($dependencies);
      if ($count > 0) {
        drush_quickupdate_qup_download_missing_dependencies();
      }
    }
    drush_print("\n");
  }
  else {
    drush_print("\n");
    drush_print(dt('There are no more missing dependency projects.'));
  }
}