N°2793 Log rotation : add file exists check in the lock

This commit is contained in:
Pierre Goiffon
2020-03-02 18:33:00 +01:00
parent fad00200b6
commit 33f3f2810e

View File

@@ -173,6 +173,11 @@ abstract class RotatingLogFileNameBuilder implements iLogFileNameBuilder
{
$oLock = new iTopMutex('log_rotation_'.$this->sLogFileFullPath);
$oLock->Lock();
if (!$this->IsLogFileExists()) // extra extra check if we were blocked and another process moved the file in the meantime
{
$oLock->Unlock();
return;
}
$this->ResetLastModifiedDateForFile();
$sNewLogFileName = $this->GetRotatedFileName($oLogFileLastModified);
rename($this->sLogFileFullPath, $sNewLogFileName);