From dcd5ea18c119feff757561725ee6a7cc2fff0cfc Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole Date: Mon, 13 Oct 2014 13:06:41 +0100 Subject: [PATCH] Issue #2302799 by alexpott, penyaskito: Fixed InstallerTestBase tests can not be run locally. --- core/includes/file.inc | 6 +++--- core/includes/install.core.inc | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/includes/file.inc b/core/includes/file.inc index 78fdbfa00428..6030f1433976 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -1032,14 +1032,14 @@ function file_delete_multiple(array $fids) { * @see file_unmanaged_delete_recursive() */ function file_unmanaged_delete($path) { + if (is_file($path)) { + return drupal_unlink($path); + } $logger = \Drupal::logger('file'); if (is_dir($path)) { $logger->error('%path is a directory and cannot be removed using file_unmanaged_delete().', array('%path' => $path)); return FALSE; } - if (is_file($path)) { - return drupal_unlink($path); - } // Return TRUE for non-existent file, but log that nothing was actually // deleted, as the current state is the intended result. if (!file_exists($path)) { diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 33d2a0e0c0f6..adb7d81abb84 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -2037,8 +2037,9 @@ function install_check_requirements($install_state) { // common configuration on shared hosting, and there is nothing Drupal // can do to prevent it. In this situation, having $file also owned by // the webserver does not introduce any additional security risk, so we - // keep the file in place. - if (fileowner($default_file) === fileowner($file)) { + // keep the file in place. Additionally, this situation also occurs when + // the test runner is being run be different user than the webserver. + if (fileowner($default_file) === fileowner($file) || DRUPAL_TEST_IN_CHILD_SITE) { $readable = drupal_verify_install_file($file, FILE_READABLE); $writable = drupal_verify_install_file($file, FILE_WRITABLE); $exists = TRUE;