mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 01:28:47 +02:00
N°2793 Log rotation : add file exists check in the lock
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user