diff --git a/core/includes/file.inc b/core/includes/file.inc index 78fdbfa0042850180c7ec7e171072d2a09de3f0a..6030f14339764aff7f9ce6b13396329e9bbe643d 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 33d2a0e0c0f6dddc66932e0d1359dce05a47628e..adb7d81abb846daa98bf8f79a321560a73df3346 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;