diff options
author | Andrew Dolgov <[email protected]> | 2007-09-25 04:23:29 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2007-09-25 04:23:29 +0100 |
commit | 31a6d42de4be9cb20317a7744190c891cd1ded55 (patch) | |
tree | 4d51a559bb8c925939cba7d4dfa13622f4a1620d /functions.php | |
parent | 0d826d02795dedb593c9de309240400ed85b709e (diff) |
lock checking in update_feeds.php
Diffstat (limited to 'functions.php')
-rw-r--r-- | functions.php | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/functions.php b/functions.php index 163b4adda..116082988 100644 --- a/functions.php +++ b/functions.php @@ -1720,17 +1720,19 @@ } 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); + if (function_exists('flock')) { + 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 false; + return true; } - fclose($fp); - return true; } return false; } |