Config - fix locking issue when already owning the lock [2], fix regression in ed1d8a6260

When not locked loadFromStream() will unlock the file, effectivly leaving us with an unlocked file (but marked as locked).
This commit is contained in:
Ad Schellevis 2024-04-09 19:51:35 +02:00
parent 231a4d48de
commit a86c0de203
1 changed files with 3 additions and 2 deletions

View File

@ -786,11 +786,12 @@ class Config extends Singleton
{
if ($this->config_file_handle !== null) {
flock($this->config_file_handle, LOCK_EX);
if ($reload && !$this->statusIsLocked) {
$do_reload = $reload && !$this->statusIsLocked;
$this->statusIsLocked = true;
if ($do_reload) {
/* Only lock when the exclusive lock wasn't ours yet. */
$this->load();
}
$this->statusIsLocked = true;
}
return $this;
}