| Conditions | 4 |
| Paths | 6 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function handle() |
||
| 18 | { |
||
| 19 | $hasError = false; |
||
| 20 | |||
| 21 | $statuses = BackupDestinationStatusFactory::createForMonitorConfig(config('backup.monitor_backups')); |
||
| 22 | |||
| 23 | foreach ($statuses as $backupDestinationStatus) { |
||
| 24 | $diskName = $backupDestinationStatus->backupDestination()->diskName(); |
||
| 25 | |||
| 26 | if ($backupDestinationStatus->isHealthy()) { |
||
| 27 | $this->info("The backups on {$diskName} are considered healthy."); |
||
| 28 | event(new HealthyBackupWasFound($backupDestinationStatus)); |
||
| 29 | } else { |
||
| 30 | $hasError = true; |
||
| 31 | $this->error("The backups on {$diskName} are considered unhealthy!"); |
||
| 32 | event(new UnHealthyBackupWasFound($backupDestinationStatus)); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | if ($hasError) { |
||
| 37 | return 1; |
||
| 38 | } |
||
| 39 | } |
||
| 40 | } |
||
| 41 |