Conditions | 6 |
Paths | 6 |
Total Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
35 | public function handle(Filesystem $filesystem): void |
||
36 | { |
||
37 | if (! $this->confirmToProceed('Application In Production! Will be deleted all log files from storage/log folder!')) { |
||
38 | return; |
||
39 | } |
||
40 | |||
41 | $logFiles = $filesystem->allFiles(storage_path('logs')); |
||
42 | if (empty($logFiles)) { |
||
43 | $this->comment('Log files does not found in path ' . storage_path('logs')); |
||
44 | |||
45 | return; |
||
46 | } |
||
47 | |||
48 | foreach ($logFiles as $file) { |
||
49 | if ($file->getExtension() !== 'log') { |
||
50 | continue; |
||
51 | } |
||
52 | |||
53 | $status = $filesystem->delete($file->getRealPath()); |
||
54 | if (! $status) { |
||
55 | continue; |
||
56 | } |
||
57 | |||
58 | $this->info('Successfully deleted: ' . $file); |
||
59 | } |
||
60 | } |
||
61 | } |
||
62 |