summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/functions.php b/functions.php
index 55e785488..f813b6baa 100644
--- a/functions.php
+++ b/functions.php
@@ -928,6 +928,22 @@
}
}
+ function file_is_locked($filename) {
+ error_reporting(0);
+ $fp = fopen($filename, "r");
+ error_reporting(DEFAULT_ERROR_LEVEL);
+ if ($fp) {
+ if (flock($fp, LOCK_EX | LOCK_NB)) {
+ flock($fp, LOCK_UN);
+ fclose($fp);
+ return false;
+ }
+ fclose($fp);
+ return true;
+ }
+ return false;
+ }
+
function make_lockfile($filename) {
$fp = fopen($filename, "w");