Skip to content

Commit

Permalink
MDL-23984 replacing custom mkdir with standard api in user pix upload
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Aug 29, 2010
1 parent d8fa455 commit 48183b4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions admin/uploadpicture.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,21 @@
*
* @param string $dir where to create the temp directory.
* @param string $prefix prefix for the temp directory name (default '')
* @param string $mode permissions for the temp directory (default 700)
*
* @return string The full path to the temp directory.
*/
function my_mktempdir($dir, $prefix='', $mode=0700) {
function my_mktempdir($dir, $prefix='') {
global $CFG;

if (substr($dir, -1) != '/') {
$dir .= '/';
}

do {
$path = $dir.$prefix.mt_rand(0, 9999999);
} while (!mkdir($path, $mode));
} while (file_exists($path));

check_dir_exists($path);

return $path;
}
Expand Down

0 comments on commit 48183b4

Please sign in to comment.