note 101423 added to function.fileperms
| From: | fmaz008 at gmail dot com | Date: | Wed, 15 Dec 2010 22:19:41 +0000 |
| Subject: | note 101423 added to function.fileperms | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174966@lists.php.net to get a copy of this message | ||
If you want to test if a file have the permission requirement (let say prior to do a chmod, avoiding
doing useless chmod), you can do this:
<?php
$wantedPerms = 0644;
$actualPerms = fileperms($file);
if($actualPerms < $wantedPerms)
chmod($file, $wantedPerms);
?>
----
Server IP: 216.235.13.26
Probable Submitter: 24.37.122.45
----
Manual Page -- http://www.php.net/manual/en/function.fileperms.php
Edit -- https://master.php.net/note/edit/101423
Del: integrated -- https://master.php.net/note/delete/101423/integrated
Del: useless -- https://master.php.net/note/delete/101423/useless
Del: bad code -- https://master.php.net/note/delete/101423/bad+code
Del: spam -- https://master.php.net/note/delete/101423/spam
Del: non-english -- https://master.php.net/note/delete/101423/non-english
Del: in docs -- https://master.php.net/note/delete/101423/in+docs
Del: other reasons-- https://master.php.net/note/delete/101423
Reject -- https://master.php.net/note/reject/101423
Search -- https://master.php.net/manage/user-notes.php