require PHP to have support for flock()
This commit is contained in:
parent
a2af3a6bb4
commit
4d825fa6a6
|
@ -541,6 +541,10 @@ class Config {
|
||||||
array_push($errors, "PHP support for JSON is required, but was not found.");
|
array_push($errors, "PHP support for JSON is required, but was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists("flock")) {
|
||||||
|
array_push($errors, "PHP support for flock() function is required.");
|
||||||
|
}
|
||||||
|
|
||||||
if (!class_exists("PDO")) {
|
if (!class_exists("PDO")) {
|
||||||
array_push($errors, "PHP support for PDO is required but was not found.");
|
array_push($errors, "PHP support for PDO is required but was not found.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -366,7 +366,6 @@
|
||||||
|
|
||||||
function file_is_locked(string $filename): bool {
|
function file_is_locked(string $filename): bool {
|
||||||
if (file_exists(Config::get(Config::LOCK_DIRECTORY) . "/$filename")) {
|
if (file_exists(Config::get(Config::LOCK_DIRECTORY) . "/$filename")) {
|
||||||
if (function_exists('flock')) {
|
|
||||||
$fp = @fopen(Config::get(Config::LOCK_DIRECTORY) . "/$filename", "r");
|
$fp = @fopen(Config::get(Config::LOCK_DIRECTORY) . "/$filename", "r");
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
if (flock($fp, LOCK_EX | LOCK_NB)) {
|
if (flock($fp, LOCK_EX | LOCK_NB)) {
|
||||||
|
@ -379,8 +378,6 @@
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true; // consider the file always locked and skip the test
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue