checking if a file is locked before trying to open it for write?
| From: | Jeffry Killen | Date: | Tue, 17 Feb 2015 20:59:33 +0000 |
| Subject: | checking if a file is locked before trying to open it for write? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-324481@lists.php.net to get a copy of this message | ||
I've been reading my copy of the manual regarding flock() and it
appears that a script will have to try to open the file before finding
out if it is locked.
So, if another script has a lock on the file and the current script
does is_writable on the file, will it return false (and trying to open
the file will generate a permission denied error ?).
This assumes a multi user situation, like two or more admin users
are logged into one cms system and are trying to editing the same
file at the same time.
Thanks
JK