diff --git a/core/includes/install.inc b/core/includes/install.inc index 39b4a02..5400ce0 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -448,17 +448,25 @@ function drupal_install_system() { * TRUE on success or FALSE on failure. A message is set for the latter. */ function drupal_verify_install_file($file, $mask = NULL, $type = 'file') { + // If type is not set, we cannot try to set the check function. + if (!isset($type)) { + return FALSE; + } + // Use is_file(), is_dir() or is_link() according to the type of file. + $check = 'is_' . $type; + // If it is not a type we can check for, return. + if (!function_exists($check)) { + return FALSE; + } + $return = TRUE; // Check for files that shouldn't be there. - if (isset($mask) && ($mask & FILE_NOT_EXIST) && is_file($file)) { + if (isset($mask) && ($mask & FILE_NOT_EXIST) && $check($file)) { return FALSE; } // Verify that the file is the type of file it is supposed to be. - if (isset($type) && is_file($file)) { - $check = 'is_' . $type; - if (!function_exists($check) || !$check($file)) { - $return = FALSE; - } + if (!$check($file)) { + return FALSE; } // Verify file permissions. @@ -468,11 +476,11 @@ function drupal_verify_install_file($file, $mask = NULL, $type = 'file') { if ($mask & $current_mask) { switch ($current_mask) { case FILE_EXIST: - if (!is_file($file)) { + if (!$check($file)) { if ($type == 'dir') { drupal_install_mkdir($file, $mask); } - if (!is_file($file)) { + if (!$check($file)) { $return = FALSE; } } @@ -577,8 +585,11 @@ function drupal_install_mkdir($file, $mask, $message = TRUE) { * TRUE/FALSE whether or not we were able to fix the file's permissions. */ function drupal_install_fix_file($file, $mask, $message = TRUE) { + // Use file_exists() since with will return true also for directories and + // these checks are should be done for any type: file, dir, link. + // If $file does not exist, fileperms() issues a PHP warning. - if (!is_file($file)) { + if (!file_exists($file)) { return FALSE; } diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index 8dbb5a7..64e6169 100644 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -575,6 +575,6 @@ * * Keep this code block at the end of this file to take full effect. */ -# if (file_exists(DRUPAL_ROOT . '/' . $conf_path . '/settings.local.php')) { +# if (is_file(DRUPAL_ROOT . '/' . $conf_path . '/settings.local.php')) { # include DRUPAL_ROOT . '/' . $conf_path . '/settings.local.php'; # }