Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.419
diff -u -p -r1.419 bootstrap.inc
--- includes/bootstrap.inc	16 Sep 2010 01:10:38 -0000	1.419
+++ includes/bootstrap.inc	20 Sep 2010 05:57:44 -0000
@@ -688,7 +688,7 @@ function drupal_get_filename($type, $nam
   // when a database connection fails.
   else {
     try {
-      if (function_exists('db_query')) {
+      if (!empty($GLOBALS['databases']) && function_exists('db_query')) {
         $file = db_query("SELECT filename FROM {system} WHERE name = :name AND type = :type", array(':name' => $name, ':type' => $type))->fetchField();
         if (file_exists($file)) {
           $files[$type][$name] = $file;
