function update_main_prepare

8.0.x update_6.inc update_main_prepare()
8.0.x update_7.inc update_main_prepare()
6.x update_6.inc update_main_prepare()
6.x update.inc update_main_prepare()
6.x update_7.inc update_main_prepare()
7.x update_6.inc update_main_prepare()
7.x update_7.inc update_main_prepare()
3.x update_6.inc update_main_prepare()
3.x update_7.inc update_main_prepare()
4.x update_6.inc update_main_prepare()
4.x update.inc update_main_prepare()
5.x update_6.inc update_main_prepare()
5.x update.inc update_main_prepare()
5.x update_7.inc update_main_prepare()
master update_7.inc update_main_prepare()
4 calls to update_main_prepare()
update_main in commands/core/drupal/update_6.inc
update_main in commands/core/drupal/update_7.inc
_update_batch_command in commands/core/drupal/update_6.inc
_update_batch_command in commands/core/drupal/update_7.inc

File

commands/core/drupal/update_6.inc, line 305
Update.php for provisioned sites. This file is a derivative of the standard drupal update.php, which has been modified to allow being run from the command line.

Code

function update_main_prepare() {
  global $profile;
  // Some unavoidable errors happen because the database is not yet up-to-date.
  // Our custom error handler is not yet installed, so we just suppress them.
  drush_errors_off();

  require_once './includes/bootstrap.inc';
  // Minimum load of components.
  // This differs from the Drupal 6 update.php workflow for compatbility with
  // the Drupal 6 backport of module_implements() caching.
  // @see http://drupal.org/node/557542
  drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_DATABASE);
  require_once './includes/install.inc';
  require_once './includes/file.inc';
  require_once './modules/system/system.install';

  // Load module basics.
  include_once './includes/module.inc';
  $module_list['system']['filename'] = 'modules/system/system.module';
  $module_list['filter']['filename'] = 'modules/filter/filter.module';
  module_list(TRUE, FALSE, FALSE, $module_list);
  module_implements('', FALSE, TRUE);

  drupal_load('module', 'system');
  drupal_load('module', 'filter');

  // Set up $language, since the installer components require it.
  drupal_init_language();

  // Set up theme system for the maintenance page.
  drupal_maintenance_theme();

  // Check the update requirements for Drupal.
  update_check_requirements();

  drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_FULL);
  $profile = variable_get('install_profile', 'default');
  // Updates only run reliably if user ID #1 is logged in. For example, node_delete() requires elevated perms in D5/6.
  if (!drush_get_context('DRUSH_USER')) {
    drush_set_option('user', 1);
    drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_LOGIN);
  }

  // This must happen *after* drupal_bootstrap(), since it calls
  // variable_(get|set), which only works after a full bootstrap.
  _drush_log_update_sql(update_create_batch_table());

  // Turn error reporting back on. From now on, only fatal errors (which are
  // not passed through the error handler) will cause a message to be printed.
  drush_errors_on();

  // Perform Drupal 5.x to 6.x updates that are required for update.php to function properly.
  _drush_log_update_sql(update_fix_d6_requirements());

  // Must unset $theme->status in order to safely rescan and repopulate
  // the system table to ensure we have a full picture of the platform.
  // This is needed because $theme->status is set to 0 in a call to
  // list_themes() done by drupal_maintenance_theme().
  // It is a issue with _system_theme_data() that returns its own cache
  // variable and can be modififed by others. When this is fixed in
  // drupal core we can remove this unset.
  // For reference see: http://drupal.org/node/762754
  $themes = _system_theme_data();
  foreach ($themes as $theme) {
    unset($theme->status);
  }
  drush_get_extensions();

  include_once './includes/batch.inc';
  drupal_load_updates();

  // Disable anything in the {system} table that is not compatible with the current version of Drupal core.
  _drush_log_update_sql(update_fix_compatibility());
}