/////////////////////////////////////////////////
repo:    drupal-6.x-dev
target:  core
branch:  
tags:    
node:    d859fbeb71608018850f4be4cd0c4cfa7a48a2e5
changes:
* backport [#312144]: Install fails when default.settings.php is not present
/////////////////////////////////////////////////
=================================================
message: backport [#312144]: Install fails when default.settings.php is not present
branch:  
tags:    tip
node:    e8ab439dbb460e61718e74ff3a2983a09332d00d
=================================================
diff -r d859fbeb7160 -r e8ab439dbb46 includes/install.inc
--- includes/install.inc	Sat Jun 05 14:25:20 2010 -0500
+++ includes/install.inc	Sat Jun 05 14:44:59 2010 -0500
@@ -550,6 +550,11 @@ function drupal_install_mkdir($file, $ma
  *  TRUE/FALSE whether or not we were able to fix the file's permissions.
  */
 function drupal_install_fix_file($file, $mask, $message = TRUE) {
+  // If $file does not exist, fileperms() issues a PHP warning.
+  if (!file_exists($file)) {
+    return FALSE;
+  }
+  
   $mod = fileperms($file) & 0777;
   $masks = array(FILE_READABLE, FILE_WRITABLE, FILE_EXECUTABLE, FILE_NOT_READABLE, FILE_NOT_WRITABLE, FILE_NOT_EXECUTABLE);
 
diff -r d859fbeb7160 -r e8ab439dbb46 install.php
--- install.php	Sat Jun 05 14:25:20 2010 -0500
+++ install.php	Sat Jun 05 14:44:59 2010 -0500
@@ -891,6 +891,7 @@ function install_check_requirements($pro
     $writable = FALSE;
     $conf_path = './'. conf_path(FALSE, TRUE);
     $settings_file = $conf_path .'/settings.php';
+    $default_settings_file = './sites/default/default.settings.php';
     $file = $conf_path;
     $exists = FALSE;
     // Verify that the directory exists.
@@ -903,14 +904,23 @@ function install_check_requirements($pro
         $writable = drupal_verify_install_file($settings_file, FILE_READABLE|FILE_WRITABLE);
       }
     }
+    
+    // If default.settings.php does not exist, or is not readable, throw an
+    // error.
+    if (!drupal_verify_install_file($default_settings_file, FILE_EXIST|FILE_READABLE)) {
+      drupal_set_message(st('The @drupal installer requires that the %default-file file not be modified in any way from the original download.', array('@drupal' => drupal_install_profile_name(), '%default-file' => $default_settings_file)), 'error');
+    }
+
+    // If settings.php does not exist, throw an error.
     if (!$exists) {
       drupal_set_message(st('The @drupal installer requires that you create a settings file as part of the installation process.
 <ol>
 <li>Copy the %default_file file to %file.</li>
 <li>Change file permissions so that it is writable by the web server. If you are unsure how to grant file permissions, please consult the <a href="@handbook_url">on-line handbook</a>.</li>
 </ol>
-More details about installing Drupal are available in INSTALL.txt.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '%default_file' => $conf_path .'/default.settings.php', '@handbook_url' => 'http://drupal.org/server-permissions')), 'error');
+More details about installing Drupal are available in INSTALL.txt.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '%default_file' => $default_settings_file, '@handbook_url' => 'http://drupal.org/server-permissions')), 'error');
     }
+    // If settings.php is not writable, throw an error.
     elseif (!$writable) {
       drupal_set_message(st('The @drupal installer requires write permissions to %file during the installation process. If you are unsure how to grant file permissions, please consult the <a href="@handbook_url">on-line handbook</a>.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '@handbook_url' => 'http://drupal.org/server-permissions')), 'error');
     }
/////////////////////////////////////////////////
generated with: drudiff drupal-6.x-dev . 1 2 
/////////////////////////////////////////////////
