mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-15 17:15:57 +00:00
fix file_is_locked
This commit is contained in:
@@ -961,7 +961,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function file_is_locked($filename) {
|
function file_is_locked($filename) {
|
||||||
if (function_exists('flock') && file_exists(LOCK_DIRECTORY . "/$filename")) {
|
if (file_exists(LOCK_DIRECTORY . "/$filename")) {
|
||||||
|
if (function_exists('flock')) {
|
||||||
$fp = @fopen(LOCK_DIRECTORY . "/$filename", "r");
|
$fp = @fopen(LOCK_DIRECTORY . "/$filename", "r");
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
if (flock($fp, LOCK_EX | LOCK_NB)) {
|
if (flock($fp, LOCK_EX | LOCK_NB)) {
|
||||||
@@ -976,7 +977,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true; // consider the file always locked and skip the test
|
return true; // consider the file always locked and skip the test
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function make_lockfile($filename) {
|
function make_lockfile($filename) {
|
||||||
$fp = fopen(LOCK_DIRECTORY . "/$filename", "w");
|
$fp = fopen(LOCK_DIRECTORY . "/$filename", "w");
|
||||||
|
|||||||
Reference in New Issue
Block a user