Created
February 11, 2013 18:38
-
-
Save vijaycs85/4756532 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// If the URI has a scheme, don't override the umask - schemes can handle this | |
// issue in their own implementation. | |
if (file_uri_scheme($uri)) { | |
return _drupal_mkdir_call($uri, $mode, $recursive, $context); | |
} | |
// If recursive, create each missing component of the parent directory | |
// individually and set the mode explicitly to override the umask. | |
if ($recursive) { | |
$components = explode(DIRECTORY_SEPARATOR, $uri); | |
array_pop($components); | |
$recursive_path = ''; | |
foreach ($components as $component) { | |
$recursive_path .= $component; | |
if (!file_exists($recursive_path)) { | |
if (!_drupal_mkdir_call($recursive_path, $mode, FALSE, $context)) { | |
return FALSE; | |
} | |
// Not necessary to use drupal_chmod() as there is no scheme. | |
if (!chmod($recursive_path, $mode)) { | |
return FALSE; | |
} | |
} | |
$recursive_path .= DIRECTORY_SEPARATOR; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment