function drush_upgrade_site_upgrade_prepare

4.x upgrade.drush.inc drush_upgrade_site_upgrade_prepare()

Prepare to upgrade; the first step is to disable all contrib modules.

File

commands/core/upgrade.drush.inc, line 493
Refine your Drupal major version upgrade.

Code

function drush_upgrade_site_upgrade_prepare() {
  $contrib_extensions = func_get_args();
  $uninstall_extensions = explode(',', drush_get_option('uninstall', ''));

  // Set theme back to garland per Upgrade.txt.
  variable_set('theme_default', 'garland');

  // http://drupal.org/node/724102 recommends using "seven" as your admin theme.  Don't switch it to garland if it is already seven.
  $admin_theme = variable_get('admin_theme', NULL);
  if ($admin_theme != "seven") {
    variable_set('admin_theme', 'garland');
  }
  else {
    drush_log(dt("Admin theme is already set to 'seven'."), 'ok');
  }

  // Disable all contrib modules per Upgrade.txt.
  drush_log(dt("Disabling !list", array('!list' => implode(", ", $contrib_extensions))), 'ok');
  call_user_func_array('drush_pm_disable', $contrib_extensions);
  if (drush_get_error()) {
    return FALSE; // Early exit if we see an error.
  }

  // Uninstall any modules specified via the --uninstall flag.
  if (!empty($uninstall_extensions)) {
    drush_log(dt("Uninstalling !list", array('!list' => implode(", ", $uninstall_extensions))), 'ok');
    call_user_func_array('drush_pm_uninstall', $uninstall_extensions);
    if (drush_get_error()) {
      return FALSE; // Early exit if we see an error.
    }
  }
}