Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.681 diff -u -p -r1.681 common.inc --- includes/common.inc 29 Aug 2007 18:38:55 -0000 1.681 +++ includes/common.inc 30 Aug 2007 06:54:03 -0000 @@ -1792,8 +1792,15 @@ function drupal_get_js($scope = 'header' $no_preprocess = array('core' => '', 'module' => '', 'theme' => ''); $files = array(); $preprocess_js = variable_get('preprocess_js', FALSE); - $directory = file_directory_path(); - $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC); + + // If database connection failed, don't attempt to aggregate JavaScript. + if (function_exists('file_directory_path')) { + $directory = file_directory_path(); + $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC); + } + else { + $is_writable = FALSE; + } foreach ($javascript as $type => $data) {