Skip to content
Snippets Groups Projects
Commit 594a2af7 authored by Bart Visscher's avatar Bart Visscher
Browse files

Review fixes

parent b5e2842e
No related branches found
No related tags found
No related merge requests found
......@@ -11,16 +11,16 @@ namespace OC\Log;
class Rotate extends \OC\BackgroundJob\Job {
const LOG_SIZE_LIMIT = 104857600; // 100 MB
public function run($logFile) {
$filesize = filesize($logFile);
$filesize = @filesize($logFile);
if ($filesize >= self::LOG_SIZE_LIMIT) {
$this->rotate($logFile);
}
}
protected function rotate($logfile) {
$rotated_logfile = $logfile.'.1';
rename($logfile, $rotated_logfile);
$msg = 'Log file "'.$logfile.'" was over 100MB, moved to "'.$rotated_logfile.'"';
$rotatedLogfile = $logfile.'.1';
rename($logfile, $rotatedLogfile);
$msg = 'Log file "'.$logfile.'" was over 100MB, moved to "'.$rotatedLogfile.'"';
\OC_Log::write('OC\Log\Rotate', $msg, \OC_Log::WARN);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment