diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-10-19 21:27:13 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-10-19 21:27:13 +0000 |
commit | 3de6420cd5da8d055f256e0983bc2cbe65fd1514 (patch) | |
tree | bb28fcd6174aa5d97e14e5976dc43eda26c97c12 | |
parent | d6d712527245ce4664875161d1048fe65a7d2418 (diff) | |
download | brdo-3de6420cd5da8d055f256e0983bc2cbe65fd1514.tar.gz brdo-3de6420cd5da8d055f256e0983bc2cbe65fd1514.tar.bz2 |
- Patch #323372 by chx: clean up drupal_bootstrap().
-rw-r--r-- | includes/bootstrap.inc | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index f7e9b2655..e6bdaa736 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -1020,17 +1020,17 @@ function drupal_anonymous_user($session = '') { * DRUPAL_BOOTSTRAP_PATH: set $_GET['q'] to Drupal path of request. * DRUPAL_BOOTSTRAP_FULL: Drupal is fully loaded, validate and fix input data. */ -function drupal_bootstrap($phase) { - static $phases = array(DRUPAL_BOOTSTRAP_CONFIGURATION, DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE, DRUPAL_BOOTSTRAP_DATABASE, DRUPAL_BOOTSTRAP_ACCESS, DRUPAL_BOOTSTRAP_SESSION, DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE, DRUPAL_BOOTSTRAP_LANGUAGE, DRUPAL_BOOTSTRAP_PATH, DRUPAL_BOOTSTRAP_FULL), $phase_index = 0; - - while ($phase >= $phase_index && isset($phases[$phase_index])) { - $current_phase = $phases[$phase_index]; - unset($phases[$phase_index++]); - _drupal_bootstrap($current_phase); - - global $_drupal_current_bootstrap_phase; - $_drupal_current_bootstrap_phase = $current_phase; +function drupal_bootstrap($phase = NULL) { + static $phases = array(DRUPAL_BOOTSTRAP_CONFIGURATION, DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE, DRUPAL_BOOTSTRAP_DATABASE, DRUPAL_BOOTSTRAP_ACCESS, DRUPAL_BOOTSTRAP_SESSION, DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE, DRUPAL_BOOTSTRAP_LANGUAGE, DRUPAL_BOOTSTRAP_PATH, DRUPAL_BOOTSTRAP_FULL), $completed_phase = -1; + + if (isset($phase) && $phase > $completed_phase) { + while ($phases) { + $current_phase = array_shift($phases); + _drupal_bootstrap($current_phase); + $completed_phase = $current_phase; + } } + return $completed_phase; } /** @@ -1041,8 +1041,7 @@ function drupal_bootstrap($phase) { * @see drupal_bootstrap */ function drupal_get_bootstrap_phase() { - global $_drupal_current_bootstrap_phase; - return $_drupal_current_bootstrap_phase; + return drupal_bootstrap(); } function _drupal_bootstrap($phase) { |