diff --git a/core/includes/file.inc b/core/includes/file.inc index 551e983..cc1604e 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -2361,7 +2361,9 @@ function drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL) { foreach (explode('/', $uri_flat) as $uri_element) { $uri_existing .= '/' . $uri_element; // Fail if permisions can not be changed. - $success = drupal_chmod($uri_existing, $mode); + if (!$success = drupal_chmod($uri_existing, $mode)) { + break; + } } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php b/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php index 497f2eb..3edc12a 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php @@ -24,7 +24,7 @@ class DirectoryTest extends FileTestBase { * * Checks valid and invalid URI variations, single and recursively. */ - function testFileCheckDirectoryHandling() { + function testFileDirectoryHandling() { $directories = array(); // Valid stream wrapper scheme. @@ -47,21 +47,22 @@ class DirectoryTest extends FileTestBase { foreach ($directories as $directory) { // Check directory handling. - $this->checkFileCheckDirectoryHandling($directory . $this->randomName()); + $this->checkFileDirectoryHandling($directory . $this->randomName()); // Check recursively. - $this->checkFileCheckDirectoryHandling($directory . $this->randomName() . '/' . $this->randomName()); + $this->checkFileDirectoryHandling($directory . $this->randomName() . '/' . $this->randomName()); } } /** - * Helper method for testFileCheckDirectoryHandling(). + * Checks directory handling functions. * * @param string $directory * A file directory path to operate on. + * + * @see Drupal\system\Tests\File\DirectoryTest::testFileDirectoryHandling(). */ function checkFileDirectoryHandling($directory = NULL) { // Assert directory does not already exist. - // @todo check recursively? $this->assertFalse(is_dir($directory), t('Directory does not exist prior to testing.')); // Non-existent directory.