aboutsummaryrefslogtreecommitdiff
path: root/src/globals.php
diff options
context:
space:
mode:
authorCassio de Campos <cassiopc@gmail.com>2017-10-24 14:25:41 +0000
committerCassio de Campos <cassiopc@gmail.com>2017-10-24 14:25:41 +0000
commit21a525f1261bff14f65305c1b5e595a707d9f8c1 (patch)
tree1f178f93ae9f3895cc274ecf8aaea8a5e95a4e0e /src/globals.php
parent6d1514ca2435ccd650baf73ed9900b9aaf88f43b (diff)
downloadboca-21a525f1261bff14f65305c1b5e595a707d9f8c1.tar.gz
boca-21a525f1261bff14f65305c1b5e595a707d9f8c1.zip
chown issues
Diffstat (limited to 'src/globals.php')
-rwxr-xr-xsrc/globals.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/globals.php b/src/globals.php
index 6c51f41..e23e5ab 100755
--- a/src/globals.php
+++ b/src/globals.php
@@ -43,12 +43,9 @@ function filedownload($oid,$fname,$msg='') {
function dirrec($dir, $user, $group, $dirPermissions, $filePermissions, $avoid=array()) {
$ds = DIRECTORY_SEPARATOR;
if($ds=="") $ds = "/";
- $t = myunique();
- rename($dir, $dir . '.tmp' . $t);
- rename($dir . '.tmp' . $t, $dir);
- //if(chown($dir, $user) === false) echo "cannot chown $dir\n";
- //if(chgrp($dir, $group) === false) echo "cannot chgrp $dir\n";
if(is_dir($dir)) {
+ if(chown($dir, $user) === false) echo "cannot chown $dir\n";
+ if(chgrp($dir, $group) === false) echo "cannot chgrp $dir\n";
if(chmod($dir, $dirPermissions) === false) echo "cannot chmod $dir\n";
if(($dp = opendir($dir)) === false) return;
while($file = readdir($dp)) {
@@ -66,6 +63,9 @@ function dirrec($dir, $user, $group, $dirPermissions, $filePermissions, $avoid=a
}
closedir($dp);
} else {
+ $t = myunique();
+ copy($dir, $dir . '.tmp' . $t);
+ rename($dir . '.tmp' . $t, $dir);
if(chmod($dir, $filePermissions)=== false) echo "cannot chmod $dir\n";
}
}