| Total Complexity | 6 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 9 | class RotateCommand extends Command |
||
| 10 | { |
||
| 11 | protected $signature = 'rotate:logs'; |
||
| 12 | |||
| 13 | protected $description = 'Rotate logs of Laravel'; |
||
| 14 | |||
| 15 | public function handle() |
||
| 16 | { |
||
| 17 | $this->rotateLaravelLogs(); |
||
| 18 | |||
| 19 | $this->rotareForeingFiles(); |
||
| 20 | } |
||
| 21 | |||
| 22 | protected function rotateLaravelLogs() |
||
| 23 | { |
||
| 24 | foreach (LogHelper::getLaravelLogFiles() as $file) { |
||
| 25 | $this->line('Rotate file: '.$file); |
||
| 26 | |||
| 27 | $this->rotateFile($file); |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | protected function rotareForeingFiles() |
||
| 32 | { |
||
| 33 | foreach (config('rotate.foreign_files', []) as $file) { |
||
| 34 | $this->line('Rotate file: '.$file); |
||
| 35 | |||
| 36 | $this->rotateFile($file); |
||
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 40 | protected function rotateFile(string $filename) |
||
| 45 | } |
||
| 46 | } |
||
| 47 |