function _drupal_bootstrap in Drupal 6
Same name and namespace in other branches
- 4 includes/bootstrap.inc \_drupal_bootstrap()
- 5 includes/bootstrap.inc \_drupal_bootstrap()
1 call to _drupal_bootstrap()
- drupal_bootstrap in includes/bootstrap.inc
- A string describing a phase of Drupal to load. Each phase adds to the
previous one, so invoking a later phase automatically runs the earlier
phases too. The most important usage is that if you want to access the
Drupal database from a script without…
File
- includes/bootstrap.inc, line 1134
- Functions that need to be loaded on every Drupal request.
Code
function _drupal_bootstrap($phase) {
global $conf;
switch ($phase) {
case DRUPAL_BOOTSTRAP_CONFIGURATION:
drupal_unset_globals();
timer_start('page');
conf_init();
break;
case DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE:
require_once variable_get('cache_inc', './includes/cache.inc');
if (variable_get('page_cache_fastpath', FALSE) && page_cache_fastpath()) {
exit;
}
break;
case DRUPAL_BOOTSTRAP_DATABASE:
require_once './includes/database.inc';
db_set_active();
require_once variable_get('lock_inc', './includes/lock.inc');
lock_init();
break;
case DRUPAL_BOOTSTRAP_ACCESS:
if (drupal_is_denied('host', ip_address())) {
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
print 'Sorry, ' . check_plain(ip_address()) . ' has been banned.';
exit;
}
break;
case DRUPAL_BOOTSTRAP_SESSION:
require_once variable_get('session_inc', './includes/session.inc');
session_set_save_handler('sess_open', 'sess_close', 'sess_read', 'sess_write', 'sess_destroy_sid', 'sess_gc');
session_start();
break;
case DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE:
$conf = variable_init(isset($conf) ? $conf : array());
if (isset($_GET['destination']) || isset($_REQUEST['destination']) || isset($_REQUEST['edit']['destination'])) {
if (isset($_GET['destination']) && menu_path_is_external($_GET['destination'])) {
unset($_GET['destination']);
unset($_REQUEST['destination']);
}
if (isset($_REQUEST['destination']) && (!isset($_GET['destination']) || $_REQUEST['destination'] != $_GET['destination']) && menu_path_is_external($_REQUEST['destination'])) {
unset($_REQUEST['destination']);
}
if (isset($_REQUEST['edit']['destination']) && menu_path_is_external($_REQUEST['edit']['destination'])) {
unset($_REQUEST['edit']['destination']);
}
}
$cache_mode = variable_get('cache', CACHE_DISABLED);
$cache = $cache_mode == CACHE_DISABLED ? '' : page_get_cache();
if (!$cache || $cache_mode != CACHE_AGGRESSIVE) {
require_once './includes/module.inc';
bootstrap_invoke_all('boot');
}
if ($cache) {
drupal_page_cache_header($cache);
if ($cache_mode != CACHE_AGGRESSIVE) {
bootstrap_invoke_all('exit');
}
exit;
}
drupal_page_header();
break;
case DRUPAL_BOOTSTRAP_LANGUAGE:
drupal_init_language();
break;
case DRUPAL_BOOTSTRAP_PATH:
require_once './includes/path.inc';
drupal_init_path();
break;
case DRUPAL_BOOTSTRAP_FULL:
require_once './includes/common.inc';
_drupal_bootstrap_full();
break;
}
}