summaryrefslogtreecommitdiff
path: root/include/functions.php
diff options
context:
space:
mode:
authorjustauser <[email protected]>2013-05-29 07:52:20 -0400
committerjustauser <[email protected]>2013-05-29 07:52:20 -0400
commit7aab5617b689701cd9b6210132ed4e9dd55d3941 (patch)
tree7c8d51231f0c0bc9207e048437a50546c961c60d /include/functions.php
parent991418fa566ff462d9616123168c5f7f839cdc15 (diff)
parent67e0cf9a371fca46405e7df26ccc970ce6b408cc (diff)
Merge branch 'master' into jremote
latest master checkins
Diffstat (limited to 'include/functions.php')
-rw-r--r--include/functions.php25
1 files changed, 15 insertions, 10 deletions
diff --git a/include/functions.php b/include/functions.php
index 01ffa751f..bad01eb96 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -961,23 +961,28 @@
}
function file_is_locked($filename) {
- if (function_exists('flock') && file_exists(LOCK_DIRECTORY . "/$filename")) {
- $fp = @fopen(LOCK_DIRECTORY . "/$filename", "r");
- if ($fp) {
- if (flock($fp, LOCK_EX | LOCK_NB)) {
- flock($fp, LOCK_UN);
+ if (file_exists(LOCK_DIRECTORY . "/$filename")) {
+ if (function_exists('flock')) {
+ $fp = @fopen(LOCK_DIRECTORY . "/$filename", "r");
+ if ($fp) {
+ if (flock($fp, LOCK_EX | LOCK_NB)) {
+ flock($fp, LOCK_UN);
+ fclose($fp);
+ return false;
+ }
fclose($fp);
+ return true;
+ } else {
return false;
}
- fclose($fp);
- return true;
- } else {
- return false;
}
+ return true; // consider the file always locked and skip the test
+ } else {
+ return false;
}
- return true; // consider the file always locked and skip the test
}
+
function make_lockfile($filename) {
$fp = fopen(LOCK_DIRECTORY . "/$filename", "w");