note 92676 added to function.chgrp
| From: | david at ordal dot com | Date: | Mon, 03 Aug 2009 19:29:45 +0000 |
| Subject: | note 92676 added to function.chgrp | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159059@lists.php.net to get a copy of this message | ||
A recursive chgrp, based on nicolas@infosoft...'s recursive chmod.
<?php
function chgrpr($path, $uid) {
if (!is_dir($path))
return chgrp($path, $uid);
$dh = opendir($path);
while (($file = readdir($dh)) !== false) {
if($file != '.' && $file != '..') {
$fullpath = $path.'/'.$file;
if(is_link($fullpath))
return FALSE;
elseif(!is_dir($fullpath) && !chgrp($fullpath, $uid))
return FALSE;
elseif(!chgrpr($fullpath, $uid))
return FALSE;
}
}
closedir($dh);
if(chgrp($path, $uid))
return TRUE;
else
return FALSE;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 168.189.13.46
----
Manual Page -- http://www.php.net/manual/en/function.chgrp.php
Edit -- https://master.php.net/note/edit/92676
Del: integrated -- https://master.php.net/note/delete/92676/integrated
Del: useless -- https://master.php.net/note/delete/92676/useless
Del: bad code -- https://master.php.net/note/delete/92676/bad+code
Del: spam -- https://master.php.net/note/delete/92676/spam
Del: non-english -- https://master.php.net/note/delete/92676/non-english
Del: in docs -- https://master.php.net/note/delete/92676/in+docs
Del: other reasons-- https://master.php.net/note/delete/92676
Reject -- https://master.php.net/note/reject/92676
Search -- https://master.php.net/manage/user-notes.php