You are here

function upgrade_assist_download_projects in Upgrade Status 6

Form constructor to aid in downloading new project versions.

File

upgrade_assist/upgrade_assist.module, line 609
Assists in upgrading Drupal.

Code

function upgrade_assist_download_projects() {
  drupal_set_title(t('Download new project versions'));
  $projects = variable_get('upgrade_assist_projects', array());

  /* @todo Does drush have a maximum arguments limit?
    $drush = '';
    foreach (array_chunk($projects, 6) as $drush_args) {
      $drush .= 'drush dl ' . implode(' ', $drush_args) . "\n";
    }
    */
  $drush = 'drush dl --delete ' . implode(' ', array_keys($projects));
  $project_links = array();
  foreach ($projects as $name => $project) {
    $project_links[] = l($name, 'http://drupal.org/project/' . $name);
  }

  // @todo Upgrade Status knows the recommended release for each project and
  //   could provide direct download links to FTP files.
  $form['upgrades'] = array(
    '#prefix' => t('<p>Further upgrades are required. It is recommended to</p>'),
    '#theme' => 'item_list',
    '#items' => array(
      t('Copy all existing, incompatible modules (e.g., into <code>@modules-backup-path</code>).', array(
        '@modules-backup-path' => conf_path() . '/_modules',
      )),
      t('<strong>Keep</strong> them in their current location (e.g., in <code>@modules-path</code>).', array(
        '@modules-path' => conf_path() . '/modules',
      )),
      t('Download new module versions. Delete the corresponding module directories prior to extracting the new version.', array()),
      t('Using the !drush command line:
<pre class="command">
@drush-commands
</pre>
The <code>--delete</code> option may not be supported yet. In that case, you have to delete directories manually, but <strong>only</strong> those that will be replaced.', array(
        '!drush' => l('Drush', 'http://drupal.org/project/drush', array(
          'attributes' => array(
            'target' => '_blank',
          ),
        )),
        '@drush-commands' => $drush,
      )),
      array(
        'data' => t('Or downloading manually:'),
        'children' => $project_links,
      ),
    ),
  );
  return $form;
}