Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.131 diff -u -r1.131 bootstrap.inc --- includes/bootstrap.inc 22 Nov 2006 09:07:03 -0000 1.131 +++ includes/bootstrap.inc 22 Nov 2006 10:24:19 -0000 @@ -199,15 +199,13 @@ * @param $filename * The filename of the item if it is to be set explicitly rather * than by consulting the database. - * @param $check_db - * Allows the database search to be skipped (useful for pre-bootstrap - * checks where configuration paths must still be respected). * * @return * The filename of the requested item. */ -function drupal_get_filename($type, $name, $filename = NULL, $check_db = TRUE) { - static $files = array(); +function drupal_get_filename($type, $name, $filename = NULL) { + $files = array(); + global $active_db; if (!isset($files[$type])) { $files[$type] = array(); @@ -219,10 +217,15 @@ elseif (isset($files[$type][$name])) { // nothing } - elseif ($check_db && (($file = db_result(db_query("SELECT filename FROM {system} WHERE name = '%s' AND type = '%s'", $name, $type))) && file_exists($file))) { + // verify that we have an active database connection, before querying the database. + // this function is called both before we have a database connection and when a database + // connection fails. + elseif ($active_db && (($file = db_result(db_query("SELECT filename FROM {system} WHERE name = '%s' AND type = '%s'", $name, $type))) && file_exists($file))) { $files[$type][$name] = $file; } else { + // fallback to searching the filesystem if the database connection is not established or + // the requested file is not found. $config = conf_path(); $dir = (($type == 'theme_engine') ? 'themes/engines' : "${type}s"); $file = (($type == 'theme_engine') ? "$name.engine" : "$name.$type"); Index: includes/install.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.inc,v retrieving revision 1.26 diff -u -r1.26 install.inc --- includes/install.inc 21 Nov 2006 19:56:52 -0000 1.26 +++ includes/install.inc 22 Nov 2006 10:24:19 -0000 @@ -306,7 +306,7 @@ // installed, so we can't use the normal installation function. $module_list = array_diff($module_list, array('system')); - $system_path = dirname(drupal_get_filename('module', 'system', NULL, FALSE)); + $system_path = dirname(drupal_get_filename('module', 'system', NULL)); require_once './' . $system_path . '/system.install'; module_invoke('system', 'install'); $system_versions = drupal_get_schema_versions('system');