From: Robin Appelman Date: Mon, 17 Mar 2014 11:53:26 +0000 (+0100) Subject: use a non-recursive chmod on the datadir X-Git-Tag: v7.0.0alpha2~614^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=166dfbf58bd8944688c0941dfbca052a600faef1;p=nextcloud-server.git use a non-recursive chmod on the datadir --- diff --git a/lib/private/helper.php b/lib/private/helper.php index 0b1a26bbecd..f0129f7c84d 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -343,35 +343,6 @@ class OC_Helper { return $bytes; } - /** - * @brief Recursive editing of file permissions - * @param string $path path to file or folder - * @param int $filemode unix style file permissions - * @return bool - */ - static function chmodr($path, $filemode) { - if (!is_dir($path)) - return chmod($path, $filemode); - $dh = opendir($path); - if(is_resource($dh)) { - while (($file = readdir($dh)) !== false) { - if ($file != '.' && $file != '..') { - $fullpath = $path . '/' . $file; - if (is_link($fullpath)) - return false; - elseif (!is_dir($fullpath) && !@chmod($fullpath, $filemode)) - return false; elseif (!self::chmodr($fullpath, $filemode)) - return false; - } - } - closedir($dh); - } - if (@chmod($path, $filemode)) - return true; - else - return false; - } - /** * @brief Recursive copying of folders * @param string $src source folder diff --git a/lib/private/util.php b/lib/private/util.php index 920161949ae..fc78566e456 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -526,7 +526,7 @@ class OC_Util { .' cannot be listed by other users.'; $perms = substr(decoct(@fileperms($dataDirectory)), -3); if (substr($perms, -1) != '0') { - OC_Helper::chmodr($dataDirectory, 0770); + chmod($dataDirectory, 0770); clearstatcache(); $perms = substr(decoct(@fileperms($dataDirectory)), -3); if (substr($perms, 2, 1) != '0') {