2026-05-26 08:14:29 +02:00
|
|
|
<?php
|
|
|
|
|
|
2026-05-26 11:47:36 +02:00
|
|
|
use Illuminate\Support\Facades\Schedule;
|
2026-06-01 16:11:29 +02:00
|
|
|
use App\Services\BackupService;
|
|
|
|
|
use App\Models\AppSetting;
|
2026-05-26 08:14:29 +02:00
|
|
|
|
2026-05-26 11:47:36 +02:00
|
|
|
Schedule::call(function () {
|
|
|
|
|
try {
|
|
|
|
|
$emailController = new \App\Http\Controllers\EmailController();
|
|
|
|
|
$emailController->syncEmails();
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
\Illuminate\Support\Facades\Log::error('Scheduled email sync failed', ['error' => $e->getMessage()]);
|
|
|
|
|
}
|
|
|
|
|
})->name('email:sync')->everyFifteenMinutes()->withoutOverlapping();
|
2026-06-01 16:11:29 +02:00
|
|
|
|
|
|
|
|
// Backup automatico
|
|
|
|
|
Schedule::call(function () {
|
|
|
|
|
if (!AppSetting::getSetting('backup_auto_enabled', false)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
(new BackupService())->run();
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
\Illuminate\Support\Facades\Log::error('Scheduled backup failed', ['error' => $e->getMessage()]);
|
|
|
|
|
}
|
|
|
|
|
})->name('backup:auto')
|
|
|
|
|
->dailyAt((string) (AppSetting::getSetting('backup_auto_hour', 3) . ':00'))
|
|
|
|
|
->withoutOverlapping()
|
|
|
|
|
->onOneServer();
|