summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-07-23 05:57:27 +0000
committerDries Buytaert <dries@buytaert.net>2005-07-23 05:57:27 +0000
commitba1660168f2843d263e6205e6b03591c4ba98af1 (patch)
tree7cfb6450760aafe539051dec095f450ee3568cbc /includes
parent5fe4dd3221679c9d42725fe698b6e72fd9078f50 (diff)
downloadbrdo-ba1660168f2843d263e6205e6b03591c4ba98af1.tar.gz
brdo-ba1660168f2843d263e6205e6b03591c4ba98af1.tar.bz2
- Patch #27003 by Neil: use named constants instead of strings
Diffstat (limited to 'includes')
-rw-r--r--includes/bootstrap.inc35
-rw-r--r--includes/locale.inc1
-rw-r--r--includes/theme.inc2
3 files changed, 23 insertions, 15 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 4db35b208..fe85eb447 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -17,6 +17,11 @@ define('WATCHDOG_NOTICE', 0);
define('WATCHDOG_WARNING', 1);
define('WATCHDOG_ERROR', 2);
+define('DRUPAL_BOOTSTRAP_DATABASE', 0);
+define('DRUPAL_BOOTSTRAP_SESSION', 1);
+define('DRUPAL_BOOTSTRAP_PAGE_CACHE', 2);
+define('DRUPAL_BOOTSTRAP_FULL', 3);
+
/**
* Start the timer with the specified name. If you start and stop
* the same timer multiple times, the measured intervals will be
@@ -794,20 +799,21 @@ function drupal_is_denied($type, $mask) {
* previous one, so invoking a later phase automatically runs the earlier
* phases too. The most important usage is that if you want to access
* Drupal database from a script without loading anything else, you can
- * include bootstrap.inc, and call drupal_bootstrap('database').
+ * include bootstrap.inc, and call drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE).
*
* @param $phase
- * A string. Allowed values are:
- * 'database': initialize database layer.
- * 'session': initialize session handling.
- * 'page cache': load bootstrap.inc and module.inc, start the variable
- * system and try to serve a page from the cache.
- * 'full': Drupal is fully loaded, validate and fix input data.
+ * A constant. Allowed values are:
+ * DRUPAL_BOOTSTRAP_DATABASE: initialize database layer.
+ * DRUPAL_BOOTSTRAP_SESSION: initialize session handling.
+ * DRUPAL_BOOTSTRAP_PAGE_CACHE: load bootstrap.inc and module.inc, start
+ * the variable system and try to serve a page from the cache.
+ * DRUPAL_BOOTSTRAP_FULL: Drupal is fully loaded, validate and fix input
+ * data.
*/
function drupal_bootstrap($phase) {
- static $phases = array('database', 'session', 'page cache', 'full');
+ static $phases = array(DRUPAL_BOOTSTRAP_DATABASE, DRUPAL_BOOTSTRAP_SESSION, DRUPAL_BOOTSTRAP_PAGE_CACHE, DRUPAL_BOOTSTRAP_FULL);
- while ($current_phase = array_shift($phases)) {
+ while (!is_null($current_phase = array_shift($phases))) {
_drupal_bootstrap($current_phase);
if ($phase == $current_phase) {
return;
@@ -819,7 +825,7 @@ function _drupal_bootstrap($phase) {
global $conf;
switch ($phase) {
- case 'database':
+ case DRUPAL_BOOTSTRAP_DATABASE:
global $db_url, $db_prefix, $base_url;
$conf = array();
require_once conf_init() .'/settings.php';
@@ -827,12 +833,14 @@ function _drupal_bootstrap($phase) {
// Initialize the default database.
db_set_active();
break;
- case 'session':
+
+ case DRUPAL_BOOTSTRAP_SESSION:
require_once './includes/session.inc';
session_set_save_handler("sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc");
session_start();
break;
- case 'page cache':
+
+ case DRUPAL_BOOTSTRAP_PAGE_CACHE:
require_once './includes/module.inc';
// Start a page timer:
timer_start('page');
@@ -848,7 +856,8 @@ function _drupal_bootstrap($phase) {
$conf = variable_init(isset($conf) ? $conf : array());
drupal_page_header();
break;
- case 'full':
+
+ case DRUPAL_BOOTSTRAP_FULL:
require_once './includes/common.inc';
_drupal_bootstrap_full();
break;
diff --git a/includes/locale.inc b/includes/locale.inc
index fbc9ca16f..e464619b3 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -248,7 +248,6 @@ function _locale_import_po($file, $lang, $mode) {
}
}
- // Successful import
// rebuild locale cache
cache_clear_all("locale:$lang");
diff --git a/includes/theme.inc b/includes/theme.inc
index 730446743..02f74fd36 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -34,7 +34,7 @@ define('MARK_UPDATED', 2);
function init_theme() {
global $user, $custom_theme, $theme_engine, $theme_key;
- drupal_bootstrap('database');
+ drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
$themes = list_themes();
// Only select the user selected theme if it is available in the