* Fixed a bug where the lockfile would be released on exit even if
  it wasn't locked by the process
* Disabled the phpx build as it is broken
This commit is contained in:
2022-07-05 22:46:11 +02:00
parent 879bf88864
commit 88f3b75383
6 changed files with 34 additions and 13 deletions

View File

@ -8,6 +8,8 @@ class Lockfile
private int $maxLock = 3600;
private bool $locked = false;
public function __construct(string $filename)
{
$this->filename = $filename;
@ -22,15 +24,16 @@ class Lockfile
}
}
touch($this->filename);
$this->locked = true;
}
public function release()
{
if (file_exists($this->filename)) {
if ($this->locked && file_exists($this->filename)) {
unlink($this->filename);
}
$this->locked = false;
}
}
}