note 84273 added to function.chmod
| From: | nicolas at infosoft dot inf dot br | Date: | Mon, 07 Jul 2008 12:37:58 +0000 |
| Subject: | note 84273 added to function.chmod | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-141233@lists.php.net to get a copy of this message | ||
I use the code of haasje@welmers.net, but have a lite alteration. (linux symlink)
<?php
function chmod_R($path, $filemode) {
if (!is_dir($path))
return chmod($path, $filemode);
$dh = opendir($path);
while ($file = readdir($dh)) {
if($file != '.' && $file != '..') {
$fullpath = $path.'/'.$file;
if(is_link($fullpath))
return FALSE;
elseif(!is_dir($fullpath))
if (!chmod($fullpath, $filemode))
return FALSE;
elseif(!chmod_R($fullpath, $filemode))
return FALSE;
}
}
closedir($dh);
if(chmod($path, $filemode))
return TRUE;
else
return FALSE;
}
?>
thanks alls
----
Server IP: 200.185.109.13
Probable Submitter: 200.175.209.217
----
Manual Page -- http://www.php.net/manual/en/function.chmod.php
Edit -- https://master.php.net/note/edit/84273
Del: integrated -- https://master.php.net/note/delete/84273/integrated
Del: useless -- https://master.php.net/note/delete/84273/useless
Del: bad code -- https://master.php.net/note/delete/84273/bad+code
Del: spam -- https://master.php.net/note/delete/84273/spam
Del: non-english -- https://master.php.net/note/delete/84273/non-english
Del: in docs -- https://master.php.net/note/delete/84273/in+docs
Del: other reasons-- https://master.php.net/note/delete/84273
Reject -- https://master.php.net/note/reject/84273
Search -- https://master.php.net/manage/user-notes.php