mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-11-30 02:21:05 +01:00
fix file_is_locked
This commit is contained in:
parent
f638b40348
commit
8ff2a86cf3
@ -961,23 +961,28 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
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")) {
|
||||||
$fp = @fopen(LOCK_DIRECTORY . "/$filename", "r");
|
if (function_exists('flock')) {
|
||||||
if ($fp) {
|
$fp = @fopen(LOCK_DIRECTORY . "/$filename", "r");
|
||||||
if (flock($fp, LOCK_EX | LOCK_NB)) {
|
if ($fp) {
|
||||||
flock($fp, LOCK_UN);
|
if (flock($fp, LOCK_EX | LOCK_NB)) {
|
||||||
|
flock($fp, LOCK_UN);
|
||||||
|
fclose($fp);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
return false;
|
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) {
|
function make_lockfile($filename) {
|
||||||
$fp = fopen(LOCK_DIRECTORY . "/$filename", "w");
|
$fp = fopen(LOCK_DIRECTORY . "/$filename", "w");
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user