Review fixes

This commit is contained in:
Bart Visscher 2013-07-05 22:42:17 +02:00
parent b5e2842e00
commit 594a2af75a
1 changed files with 4 additions and 4 deletions

View File

@ -11,16 +11,16 @@ namespace OC\Log;
class Rotate extends \OC\BackgroundJob\Job { class Rotate extends \OC\BackgroundJob\Job {
const LOG_SIZE_LIMIT = 104857600; // 100 MB const LOG_SIZE_LIMIT = 104857600; // 100 MB
public function run($logFile) { public function run($logFile) {
$filesize = filesize($logFile); $filesize = @filesize($logFile);
if ($filesize >= self::LOG_SIZE_LIMIT) { if ($filesize >= self::LOG_SIZE_LIMIT) {
$this->rotate($logFile); $this->rotate($logFile);
} }
} }
protected function rotate($logfile) { protected function rotate($logfile) {
$rotated_logfile = $logfile.'.1'; $rotatedLogfile = $logfile.'.1';
rename($logfile, $rotated_logfile); rename($logfile, $rotatedLogfile);
$msg = 'Log file "'.$logfile.'" was over 100MB, moved to "'.$rotated_logfile.'"'; $msg = 'Log file "'.$logfile.'" was over 100MB, moved to "'.$rotatedLogfile.'"';
\OC_Log::write('OC\Log\Rotate', $msg, \OC_Log::WARN); \OC_Log::write('OC\Log\Rotate', $msg, \OC_Log::WARN);
} }
} }