Index: cron.php =================================================================== RCS file: /cvs/drupal/drupal/cron.php,v retrieving revision 1.30 diff -u -F^function -r1.30 cron.php --- cron.php 23 Jul 2005 05:57:27 -0000 1.30 +++ cron.php 3 Aug 2005 14:15:34 -0000 @@ -7,26 +7,34 @@ */ include_once 'includes/bootstrap.inc'; -drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); -// If not in 'safe mode', increase the maximum execution time: -if (!ini_get('safe_mode')) { - set_time_limit(240); +function drupal_cron_bootstrap() { + drupal_run(DRUPAL_RUN_FLUSH, array('bootstrap_db', 'bootstrap_session', 'bootstrap_page_cache','bootstrap_common','')); } -// Check if the last cron run completed -if (variable_get('cron_busy', false)) { - watchdog('cron', t('Last cron run did not complete.'), WATCHDOG_WARNING); -} -else { - variable_set('cron_busy', true); +function drupal_cron_run() { + // If not in 'safe mode', increase the maximum execution time: + if (!ini_get('safe_mode')) { + set_time_limit(240); + } + + // Check if the last cron run completed + if (variable_get('cron_busy', false)) { + watchdog('cron', t('Last cron run did not complete.'), WATCHDOG_WARNING); + } + else { + variable_set('cron_busy', true); + } + + // Iterate through the modules calling their cron handlers (if any): + module_invoke_all('cron'); + + // Clean up + variable_set('cron_busy', false); + watchdog('cron', t('Cron run completed')); } -// Iterate through the modules calling their cron handlers (if any): -module_invoke_all('cron'); +drupal_bootstrap('cron_bootstrap'); -// Clean up -variable_set('cron_busy', false); -watchdog('cron', t('Cron run completed')); ?> Index: index.php =================================================================== RCS file: /cvs/drupal/drupal/index.php,v retrieving revision 1.86 diff -u -F^function -r1.86 index.php --- index.php 23 Jul 2005 05:57:27 -0000 1.86 +++ index.php 3 Aug 2005 14:15:34 -0000 @@ -10,7 +10,7 @@ */ require_once './includes/bootstrap.inc'; -drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); +drupal_bootstrap(); $return = menu_execute_active_handler(); switch ($return) { Index: update.php =================================================================== RCS file: /cvs/drupal/drupal/update.php,v retrieving revision 1.150 diff -u -F^function -r1.150 update.php --- update.php 29 Jul 2005 20:31:03 -0000 1.150 +++ update.php 3 Aug 2005 14:15:34 -0000 @@ -185,28 +185,36 @@ function update_info() { print theme('maintenance_page', $output); } -include_once "includes/bootstrap.inc"; -drupal_maintenance_theme(); -if (isset($_GET["op"])) { - drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); +function drupal_update_bootstrap() { + drupal_run(DRUPAL_RUN_FLUSH, array('bootstrap_db', 'bootstrap_session', 'bootstrap_page_cache','bootstrap_common','bootstrap_update')); +} - // Access check: - if (($access_check == 0) || ($user->uid == 1)) { - update_page(); +function drupal_bootstrap_update() { + drupal_maintenance_theme(); + if (isset($_GET["op"])) { + drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); + + // Access check: + if (($access_check == 0) || ($user->uid == 1)) { + update_page(); + } + else { + drupal_set_title('Access denied'); + print theme('maintenance_page', '

Access denied. You are not authorized to access this page. Please log in as the admin user (the first user you created). If you cannot log in, you will have to edit update.php to bypass this access check. To do this:

+
    +
  1. With a text editor find the update.php file on your system. It should be in the main Drupal directory that you installed all the files into.
  2. +
  3. There is a line near top of update.php that says $access_check = TRUE;. Change it to $access_check = FALSE;.
  4. +
  5. As soon as the script is done, you must change the update.php script back to its original form to $access_check = TRUE;.
  6. +
  7. To avoid having this problem in future, remember to log in to your website as the admin user (the user you first created) before you backup your database at the beginning of the update process.
  8. +
'); + } } else { - drupal_set_title('Access denied'); - print theme('maintenance_page', '

Access denied. You are not authorized to access this page. Please log in as the admin user (the first user you created). If you cannot log in, you will have to edit update.php to bypass this access check. To do this:

-
    -
  1. With a text editor find the update.php file on your system. It should be in the main Drupal directory that you installed all the files into.
  2. -
  3. There is a line near top of update.php that says $access_check = TRUE;. Change it to $access_check = FALSE;.
  4. -
  5. As soon as the script is done, you must change the update.php script back to its original form to $access_check = TRUE;.
  6. -
  7. To avoid having this problem in future, remember to log in to your website as the admin user (the user you first created) before you backup your database at the beginning of the update process.
  8. -
'); + update_info(); } } -else { - update_info(); -} + +include_once "includes/bootstrap.inc"; +drupal_bootstrap("update_bootstrap"); ?> Index: xmlrpc.php =================================================================== RCS file: /cvs/drupal/drupal/xmlrpc.php,v retrieving revision 1.12 diff -u -F^function -r1.12 xmlrpc.php --- xmlrpc.php 23 Jul 2005 05:57:27 -0000 1.12 +++ xmlrpc.php 3 Aug 2005 14:15:34 -0000 @@ -7,7 +7,7 @@ */ include_once 'includes/bootstrap.inc'; -drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); +drupal_bootstrap(); include_once 'includes/xmlrpcs.inc'; xmlrpc_server(module_invoke_all('xmlrpc')); Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.59 diff -u -F^function -r1.59 bootstrap.inc --- includes/bootstrap.inc 29 Jul 2005 08:18:19 -0000 1.59 +++ includes/bootstrap.inc 3 Aug 2005 14:15:34 -0000 @@ -17,11 +17,7 @@ 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); - +include('./includes/machine.inc'); /** * Start the timer with the specified name. If you start and stop * the same timer multiple times, the measured intervals will be @@ -794,76 +790,6 @@ function drupal_is_denied($type, $mask) } /** - * 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 - * Drupal database from a script without loading anything else, you can - * include bootstrap.inc, and call drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE). - * - * @param $phase - * 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(DRUPAL_BOOTSTRAP_DATABASE, DRUPAL_BOOTSTRAP_SESSION, DRUPAL_BOOTSTRAP_PAGE_CACHE, DRUPAL_BOOTSTRAP_FULL); - - while (!is_null($current_phase = array_shift($phases))) { - _drupal_bootstrap($current_phase); - if ($phase == $current_phase) { - return; - } - } -} - -function _drupal_bootstrap($phase) { - global $conf; - - switch ($phase) { - case DRUPAL_BOOTSTRAP_DATABASE: - global $db_url, $db_prefix, $base_url; - $conf = array(); - require_once conf_init() .'/settings.php'; - require_once './includes/database.inc'; - // Initialize the default database. - db_set_active(); - break; - - 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 DRUPAL_BOOTSTRAP_PAGE_CACHE: - require_once './includes/module.inc'; - // Start a page timer: - timer_start('page'); - - // deny access to hosts which were banned. t() is not yet available. - if (drupal_is_denied('host', $_SERVER['REMOTE_ADDR'])) { - header('HTTP/1.0 403 Forbidden'); - print "Sorry, ". $_SERVER['REMOTE_ADDR']. " has been banned."; - exit(); - } - - // Initialize configuration variables, using values from conf.php if available. - $conf = variable_init(isset($conf) ? $conf : array()); - drupal_page_header(); - break; - - case DRUPAL_BOOTSTRAP_FULL: - require_once './includes/common.inc'; - _drupal_bootstrap_full(); - break; - } -} - -/** * Enables use of the theme system without requiring database access. Since * there is not database access no theme will be enabled and the default * themable fuctions will be called. Some themable functions can not be used Index: sites/default/settings.php =================================================================== RCS file: /cvs/drupal/drupal/sites/default/settings.php,v retrieving revision 1.16 diff -u -F^function -r1.16 settings.php --- sites/default/settings.php 14 Apr 2005 18:34:31 -0000 1.16 +++ sites/default/settings.php 3 Aug 2005 14:15:34 -0000 @@ -78,7 +78,7 @@ * $db_url = 'mysql://username:password@localhost/database'; * $db_url = 'pgsql://username:password@localhost/database'; */ -$db_url = 'mysql://username:password@localhost/database'; +$db_url = 'mysql://root@localhost/default'; $db_prefix = ''; /**