diff options
-rw-r--r-- | it_url.class | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/it_url.class b/it_url.class index cfa2bef..8594006 100644 --- a/it_url.class +++ b/it_url.class @@ -761,13 +761,15 @@ static function _expired($path, $maxage, $randomexpire = 0) */ static function _lock($path, $p = []) { + $mtime = @filemtime("$path.lock"); + if (!($fh = it::fopen("$path.lock", "w"))) return false; if (!flock($fh, LOCK_EX | LOCK_NB)) { - if (($mtime = @filemtime("$path.lock")) && (time() - $mtime > 30)) - it::error((array)$p['it_error'] + ['title' => "stale lock epired for $path"]); # FIXME 2023-07 DF remove stale lock expiration if never triggered + if ($mtime && (time() - $mtime > 30)) + it::error((array)$p['it_error'] + ['title' => "stale lock epired for $path"]); # FIXME 2024-07 DF remove stale lock expiration if never triggered else return false; } |