--- includes/bootstrap.inc (/mirrors/drupal/drupal) (revision 69) +++ includes/bootstrap.inc (/local/branches/bootstrap) (local) @@ -76,56 +76,6 @@ function timer_stop($name) { } /** - * Locate the appropriate configuration file. - * - * Try finding a matching configuration directory by stripping the - * website's hostname from left to right and pathname from right to - * left. The first configuration file found will be used, the - * remaining will ignored. If no configuration file is found, - * return a default value '$confdir/default'. - * - * Example for a fictitious site installed at - * http://www.drupal.org/mysite/test/ the 'settings.php' is - * searched in the following directories: - * - * 1. $confdir/www.drupal.org.mysite.test - * 2. $confdir/drupal.org.mysite.test - * 3. $confdir/org.mysite.test - * - * 4. $confdir/www.drupal.org.mysite - * 5. $confdir/drupal.org.mysite - * 6. $confdir/org.mysite - * - * 7. $confdir/www.drupal.org - * 8. $confdir/drupal.org - * 9. $confdir/org - * - * 10. $confdir/default - */ -function conf_init() { - static $conf = ''; - - if ($conf) { - return $conf; - } - - $confdir = 'sites'; - $uri = explode('/', $_SERVER['PHP_SELF']); - $server = explode('.', rtrim($_SERVER['HTTP_HOST'], '.')); - for ($i = count($uri) - 1; $i > 0; $i--) { - for ($j = count($server); $j > 0; $j--) { - $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i)); - if (file_exists("$confdir/$dir/settings.php")) { - $conf = "$confdir/$dir"; - return $conf; - } - } - } - $conf = "$confdir/default"; - return $conf; -} - -/** * Returns and optionally sets the filename for a system item (module, * theme, etc.). The filename, whether provided, cached, or retrieved * from the database, is only returned if the file exists. @@ -738,19 +688,4 @@ function drupal_get_messages() { return $messages; } - -// Start a page timer: -timer_start('page'); - -unset($conf); -$config = conf_init(); - -include_once "$config/settings.php"; -include_once 'includes/database.inc'; -include_once 'includes/session.inc'; -include_once 'includes/module.inc'; - -// Initialize configuration variables, using values from conf.php if available. -$conf = variable_init(isset($conf) ? $conf : array()); - ?> --- includes/common.inc (/mirrors/drupal/drupal) (revision 69) +++ includes/common.inc (/local/branches/bootstrap) (local) @@ -779,7 +779,7 @@ function format_plural($count, $singular if ($count == 1) return t($singular, array("%count" => $count)); // get the plural index through the gettext formula - $index = (function_exists('locale')) ? locale_get_plural($count) : -1; + $index = (function_exists('locale_get_plural')) ? locale_get_plural($count) : -1; if ($index < 0) { // backward compatibility return t($plural, array("%count" => $count)); } @@ -1877,55 +1877,7 @@ function drupal_get_path($type, $name) { return dirname(drupal_get_filename($type, $name)); } -/** - * Provide a substitute clone() function for PHP4. - */ -if (version_compare(phpversion(), '5.0') < 0) { - eval(' - function clone($object) { - return $object; - } - '); -} - -// Set the Drupal custom error handler. -set_error_handler('error_handler'); - -include_once 'includes/theme.inc'; -include_once 'includes/pager.inc'; -include_once 'includes/menu.inc'; -include_once 'includes/tablesort.inc'; -include_once 'includes/file.inc'; -include_once 'includes/xmlrpc.inc'; -include_once 'includes/image.inc'; - -// Emit the correct charset HTTP header. -drupal_set_header('Content-Type: text/html; charset=utf-8'); - -// Initialize $_GET['q'] prior to loading modules and invoking hook_init(). -if (!empty($_GET['q'])) { - $_GET['q'] = drupal_get_normal_path(trim($_GET['q'], '/')); +function drupal_clone($object) { + return version_compare(phpversion(), '5.0') < 0 ? $object : clone($object); } -else { - $_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage', 'node')); -} - -// Initialize all enabled modules. -module_init(); - -if (!user_access('bypass input data check')) { - // We can't use $_REQUEST because it consists of the contents of $_POST, - // $_GET and $_COOKIE: if any of the input arrays share a key, only one - // value will be verified. - if (!valid_input_data($_GET) - || !valid_input_data($_POST) - || !valid_input_data($_COOKIE) - || !valid_input_data($_FILES)) { - die('Terminated request because of suspicious input data.'); - } -} - -// Initialize the localization system. -$locale = locale_initialize(); - ?> --- includes/database.inc (/mirrors/drupal/drupal) (revision 69) +++ includes/database.inc (/local/branches/bootstrap) (local) @@ -279,7 +279,4 @@ function db_rewrite_sql($query, $primary * @} End of "defgroup database". */ -// Initialize the default database. -db_set_active(); - ?> --- includes/menu.inc (/mirrors/drupal/drupal) (revision 69) +++ includes/menu.inc (/local/branches/bootstrap) (local) @@ -351,7 +351,7 @@ function menu_execute_active_handler() { $arguments = array_merge($arguments, explode('/', $arg)); } - return call_user_func_array($menu['items'][$mid]['callback'], $arguments); + return function_exists($menu['items'][$mid]['callback']) ? call_user_func_array($menu['items'][$mid]['callback'], $arguments) : ''; } /** --- includes/session.inc (/mirrors/drupal/drupal) (revision 69) +++ includes/session.inc (/local/branches/bootstrap) (local) @@ -6,9 +6,6 @@ * User session handling functions. */ -session_set_save_handler("sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc"); -session_start(); - /*** Session functions *****************************************************/ function sess_open($save_path, $session_name) { --- includes/theme.inc (/mirrors/drupal/drupal) (revision 69) +++ includes/theme.inc (/local/branches/bootstrap) (local) @@ -34,6 +34,7 @@ function init_theme() { global $user, $custom_theme, $theme_engine, $theme_key; + drupal_bootstrap('database'); $themes = list_themes(); // Only select the user selected theme if it is available in the --- includes/init.inc (/mirrors/drupal/drupal) (revision 69) +++ includes/init.inc (/local/branches/bootstrap) (local) @@ -0,0 +1,122 @@ + 0; $i--) { + for ($j = count($server); $j > 0; $j--) { + $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i)); + if (file_exists("$confdir/$dir/settings.php")) { + $conf = "$confdir/$dir"; + return $conf; + } + } + } + $conf = "$confdir/default"; + return $conf; +} + +function drupal_bootstrap($phase) { + static $done = -1; + + $phase = array_search($phase, array('database', 'bootstrap', 'session', 'common')); + if ($phase == FALSE) { + return; + } + + for (; $done <= $phase; $done++) { + _drupal_bootstrap($done); + } +} + +function _drupal_bootstrap($phase) { + global $conf; + + switch ($phase) { + case 0: + global $db_url, $base_url; + unset($conf); + include_once conf_init() .'/settings.php'; + include_once 'includes/database.inc'; + // Initialize the default database. + db_set_active(); + break; + case 1: + include_once 'includes/bootstrap.inc'; + // Start a page timer: + timer_start('page'); + $conf = variable_init(isset($conf) ? $conf : array()); + case 2: + include_once conf_init() .'/settings_ini_set.php'; + include_once 'includes/session.inc'; + session_set_save_handler("sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc"); + session_start(); + break; + case 3: + include_once 'includes/common.inc'; + // Set the Drupal custom error handler. + set_error_handler('error_handler'); + // Emit the correct charset HTTP header. + drupal_set_header('Content-Type: text/html; charset=utf-8'); + // Initialize $_GET['q'] prior to loading modules and invoking hook_init(). + if (!empty($_GET['q'])) { + $_GET['q'] = drupal_get_normal_path(trim($_GET['q'], '/')); + } + else { + $_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage', 'node')); + } + // Initialize all enabled modules. + module_init(); + if (!user_access('bypass input data check')) { + // We can't use $_REQUEST because it consists of the contents of $_POST, + // $_GET and $_COOKIE: if any of the input arrays share a key, only one + // value will be verified. + if (!valid_input_data($_GET) + || !valid_input_data($_POST) + || !valid_input_data($_COOKIE) + || !valid_input_data($_FILES)) { + die('Terminated request because of suspicious input data.'); + } + } + // Initialize the localization system. + $locale = locale_initialize(); + break; + } +} + +?> --- index.php (/mirrors/drupal/drupal) (revision 69) +++ index.php (/local/branches/bootstrap) (local) @@ -9,10 +9,20 @@ * prints the appropriate page. */ -include_once 'includes/bootstrap.inc'; +include_once 'includes/init.inc'; +include_once 'includes/module.inc'; +drupal_bootstrap('session'); drupal_page_header(); -include_once 'includes/common.inc'; - +drupal_bootstrap('common'); +if (!variable_get('split_mode', 0)) { + include_once 'includes/theme.inc'; + include_once 'includes/pager.inc'; + include_once 'includes/menu.inc'; + include_once 'includes/tablesort.inc'; + include_once 'includes/file.inc'; + include_once 'includes/xmlrpc.inc'; + include_once 'includes/image.inc'; +} fix_gpc_magic(); $return = menu_execute_active_handler(); --- modules/node.module (/mirrors/drupal/drupal) (revision 69) +++ modules/node.module (/local/branches/bootstrap) (local) @@ -1501,7 +1501,7 @@ function node_preview($node) { // Display a preview of the node: // Previewing alters $node so it needs to be cloned. - $output = theme('node_preview', clone($node)); + $output = theme('node_preview', drupal_clone($node)); $output .= node_form($node); --- sites/default/settings.php (/mirrors/drupal/drupal) (revision 69) +++ sites/default/settings.php (/local/branches/bootstrap) (local) @@ -90,27 +90,6 @@ $base_url = 'http://localhost'; /** - * PHP settings: - * - * To see what PHP settings are possible, including whether they can - * be set at runtime (ie., when ini_set() occurs), read the PHP - * documentation at http://www.php.net/manual/en/ini.php#ini.list - * and take a look at the .htaccess file to see which non-runtime - * settings are used there. Settings defined here should not be - * duplicated there so as to avoid conflict issues. - */ -ini_set('arg_separator.output', '&'); -ini_set('magic_quotes_runtime', 0); -ini_set('magic_quotes_sybase', 0); -ini_set('session.cache_expire', 200000); -ini_set('session.cache_limiter', 'none'); -ini_set('session.cookie_lifetime', 2000000); -ini_set('session.gc_maxlifetime', 200000); -ini_set('session.save_handler', 'user'); -ini_set('session.use_only_cookies', 1); -ini_set('session.use_trans_sid', 0); - -/** * Variable overrides: * * To override specific entries in the 'variable' table for this site, Property changes on: ___________________________________________________________________ Name: svk:merge +40268b75-2a5b-3575-9361-83c87ab9c4c0:/trunk:22070