/** * Calls the bootstrap phase. * * This method can be overridden to support events in subclasses. * * @param $current_phase * @return mixed */ public function __invoke($current_phase) { switch ($current_phase) { case DRUPAL_BOOTSTRAP_CONFIGURATION: _drupal_bootstrap_configuration(); break; case DRUPAL_BOOTSTRAP_PAGE_CACHE: _drupal_bootstrap_page_cache(); break; case DRUPAL_BOOTSTRAP_DATABASE: _drupal_bootstrap_database(); break; case DRUPAL_BOOTSTRAP_VARIABLES: _drupal_bootstrap_variables(); break; case DRUPAL_BOOTSTRAP_SESSION: require_once DRUPAL_ROOT . '/' . variable_get('session_inc', 'includes/session.inc'); drupal_session_initialize(); break; case DRUPAL_BOOTSTRAP_PAGE_HEADER: _drupal_bootstrap_page_header(); break; case DRUPAL_BOOTSTRAP_LANGUAGE: drupal_language_initialize(); break; case DRUPAL_BOOTSTRAP_FULL: require_once DRUPAL_ROOT . '/includes/common.inc'; _drupal_bootstrap_full(); break; } }
// to run updates (since it may expose sensitive information about the site's // configuration). $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : ''; if (empty($op) && update_access_allowed()) { require_once DRUPAL_ROOT . '/includes/install.inc'; require_once DRUPAL_ROOT . '/modules/system/system.install'; // Load module basics. include_once DRUPAL_ROOT . '/includes/module.inc'; $module_list['system']['filename'] = 'modules/system/system.module'; module_list(TRUE, FALSE, FALSE, $module_list); drupal_load('module', 'system'); // Reset the module_implements() cache so that any new hook implementations // in updated code are picked up. module_implements('', FALSE, TRUE); // Set up $language, since the installer components require it. drupal_language_initialize(); // Set up theme system for the maintenance page. drupal_maintenance_theme(); // Check the update requirements for Drupal. update_check_requirements(); // Redirect to the update information page if all requirements were met. install_goto('update.php?op=info'); } // update_fix_d7_requirements() needs to run before bootstrapping beyond path. // So bootstrap to DRUPAL_BOOTSTRAP_LANGUAGE then include unicode.inc. drupal_bootstrap(DRUPAL_BOOTSTRAP_LANGUAGE); include_once DRUPAL_ROOT . '/includes/unicode.inc'; update_fix_d7_requirements(); // Now proceed with a full bootstrap. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); drupal_maintenance_theme();
/** * Begin an installation request, modifying the installation state as needed. * * This function performs commands that must run at the beginning of every page * request. It throws an exception if the installation should not proceed. * * @param $install_state * An array of information about the current installation state. This is * modified with information gleaned from the beginning of the page request. */ function install_begin_request(&$install_state) { // Allow command line scripts to override server variables used by Drupal. require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; if (!$install_state['interactive']) { drupal_override_server_variables($install_state['server']); } // The user agent header is used to pass a database prefix in the request when // running tests. However, for security reasons, it is imperative that no // installation be permitted using such a prefix. if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], "simpletest") !== FALSE) { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); exit; } drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION); // This must go after drupal_bootstrap(), which unsets globals! global $conf; require_once DRUPAL_ROOT . '/modules/system/system.install'; require_once DRUPAL_ROOT . '/includes/common.inc'; require_once DRUPAL_ROOT . '/includes/file.inc'; require_once DRUPAL_ROOT . '/includes/path.inc'; // Set up $language, so t() caller functions will still work. drupal_language_initialize(); // Load module basics (needed for hook invokes). include_once DRUPAL_ROOT . '/includes/module.inc'; include_once DRUPAL_ROOT . '/includes/session.inc'; include_once DRUPAL_ROOT . '/includes/entity.inc'; $module_list['system']['filename'] = 'modules/system/system.module'; $module_list['filter']['filename'] = 'modules/filter/filter.module'; $module_list['user']['filename'] = 'modules/user/user.module'; module_list(TRUE, FALSE, FALSE, $module_list); drupal_load('module', 'system'); drupal_load('module', 'filter'); drupal_load('module', 'user'); // Load the cache infrastructure with the Fake Cache. Switch to the database cache // later if possible. require_once DRUPAL_ROOT . '/includes/cache.inc'; require_once DRUPAL_ROOT . '/includes/cache-install.inc'; $conf['cache_inc'] = 'includes/cache.inc'; $conf['cache_default_class'] = 'DrupalFakeCache'; // Prepare for themed output, if necessary. We need to run this at the // beginning of the page request to avoid a different theme accidentally // getting set. if ($install_state['interactive']) { drupal_maintenance_theme(); } // Check existing settings.php. $install_state['settings_verified'] = install_verify_settings(); if ($install_state['settings_verified']) { // Since we have a database connection, we use the normal cache system. // This is important, as the installer calls into the Drupal system for // the clean URL checks, so we should maintain the cache properly. unset($conf['cache_default_class']); // Initialize the database system. Note that the connection // won't be initialized until it is actually requested. require_once DRUPAL_ROOT . '/includes/database/database.inc'; // Verify the last completed task in the database, if there is one. $task = install_verify_completed_task(); } else { $task = NULL; // Since previous versions of Drupal stored database connection information // in the 'db_url' variable, we should never let an installation proceed if // this variable is defined and the settings file was not verified above // (otherwise we risk installing over an existing site whose settings file // has not yet been updated). if (!empty($GLOBALS['db_url'])) { throw new Exception(install_already_done_error()); } } // Modify the installation state as appropriate. $install_state['completed_task'] = $task; $install_state['database_tables_exist'] = !empty($task); // Add any installation parameters passed in via the URL. $install_state['parameters'] += $_GET; // Validate certain core settings that are used throughout the installation. if (!empty($install_state['parameters']['profile'])) { $install_state['parameters']['profile'] = preg_replace('/[^a-zA-Z_0-9]/', '', $install_state['parameters']['profile']); } if (!empty($install_state['parameters']['locale'])) { $install_state['parameters']['locale'] = preg_replace('/[^a-zA-Z_0-9\\-]/', '', $install_state['parameters']['locale']); } }