src/log4php/appenders/LoggerAppenderRollingFile.php
private function rollOver() {
		// If maxBackups <= 0, then there is no file renaming to be done.
		if($this->maxBackupIndex > 0) {
			// Delete the oldest file, to keep Windows happy.
			$file = $this->file . '.' . $this->maxBackupIndex;
			
			if (file_exists($file) && !unlink($file)) {
				throw new LoggerException("Unable to delete oldest backup file from [$file].");
			}

			// Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
			$this->renameArchievedLogs($this->file);
	
			// Backup the active file
			$this->moveToBackup($this->file);
		}
		
		// Truncate the active file
		ftruncate($this->fp, 0);
		rewind($this->fp);
	}
private function rollOver() {
		// If maxBackups <= 0, then there is no file renaming to be done.
		if($this->maxBackupIndex > 0) {
			// Delete the oldest file, to keep Windows happy.
			$file = $this->file . '.' . $this->maxBackupIndex;
			
			if (file_exists($file) && !unlink($file)) {
				throw new LoggerException("Unable to delete oldest backup file from [$file].");
			}

			// Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
			$this->renameArchievedLogs($this->file);
	
			// Backup the active file
			$this->moveToBackup($this->file);
		}
		
		// Truncate the active file
		ftruncate($this->fp, 0);
		rewind($this->fp);
	}
Implements the usual roll over behaviour.

If MaxBackupIndex is positive, then files File.1, ..., File.MaxBackupIndex -1 are renamed to File.2, ..., File.MaxBackupIndex.
Moreover, File is renamed File.1 and closed. A new File is created to receive further log output.

If MaxBackupIndex is equal to zero, then the File is truncated with no backup files created.

Rollover must be called while the file is locked so that it is safe for concurrent access.

@throws LoggerException If any part of the rollover procedure fails.