From 48183b41e94893bb4cb93e2f7b8c702ff09b46fc Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sun, 29 Aug 2010 09:38:40 +0000 Subject: [PATCH] MDL-23984 replacing custom mkdir with standard api in user pix upload --- admin/uploadpicture.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/admin/uploadpicture.php b/admin/uploadpicture.php index 172b0a100d9..402e03247ad 100644 --- a/admin/uploadpicture.php +++ b/admin/uploadpicture.php @@ -117,18 +117,21 @@ exit; * * @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; }