]> git.wh0rd.org - tt-rss.git/blobdiff - functions.php
new config option: LOCK_DIRECTORY (bump config version)
[tt-rss.git] / functions.php
index 0a55695aac00ce5df13a15968f46beab59e84fe2..b445ab6759b6fc7e3e7ac6d51410ecddc08c55ed 100644 (file)
        function file_is_locked($filename) {
                if (function_exists('flock')) {
                        error_reporting(0);
-                       $fp = fopen($filename, "r");
+                       $fp = fopen(LOCK_DIRECTORY . "/$filename", "r");
                        error_reporting(DEFAULT_ERROR_LEVEL);
                        if ($fp) {
                                if (flock($fp, LOCK_EX | LOCK_NB)) {
        }
 
        function make_lockfile($filename) {
-               $fp = fopen($filename, "w");
+               $fp = fopen(LOCK_DIRECTORY . "/$filename", "w");
 
                if (flock($fp, LOCK_EX | LOCK_NB)) {            
                        return $fp;
        }
 
        function make_stampfile($filename) {
-               $fp = fopen($filename, "w");
+               $fp = fopen(LOCK_DIRECTORY . "/$filename", "w");
 
                if (flock($fp, LOCK_EX | LOCK_NB)) {
                        fwrite($fp, time() . "\n");
        function read_stampfile($filename) {
 
                error_reporting(0);
-               $fp = fopen($filename, "r");
+               $fp = fopen(LOCK_DIRECTORY . "/$filename", "r");
                error_reporting (DEFAULT_ERROR_LEVEL);
 
                if (flock($fp, LOCK_EX)) {