Skip to content

Commit

Permalink
Bugfix: Backup error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
kreaweb.be committed Apr 29, 2024
1 parent 12e64b6 commit 8c7ce69
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions app/Http/Controllers/Back/BackupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Http\Controllers\Back;

use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Log;
Expand Down Expand Up @@ -82,24 +81,24 @@ public function index()

public function create()
{
try {
Artisan::call('backup:run --only-db');
$output = Artisan::output();
$exitCode = Artisan::call('backup:run --only-db');
$output = Artisan::output();

if ($exitCode == 0) {
Log::info("Backup (Manually) -- Backup started \r\n" . $output);

$notification = [
'type' => 'info',
'title' => 'Backups ...',
'message' => 'The backup was created.',
];
} catch (Exception $e) {
Log::info("Backup (Manually) -- Backup failed \r\n" . $e->getMessage());
} else {
Log::error("Backup (Manually) -- Backup failed \r\n" . $output);

$notification = [
'type' => 'error',
'title' => 'Backups ...',
'message' => $e->getMessage(),
'message' => 'The backup failed.',
];
}

Expand Down

0 comments on commit 8c7ce69

Please sign in to comment.