From 72b971fb0248f1fb6b3ab8f2f2d45757ad3028f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marti=CC=81n=20Go=CC=81mez?= Date: Thu, 22 Oct 2026 23:53:23 +0200 Subject: [PATCH] Skip the beacon schedule when the beacon is disabled The cachet:beacon command exits with code 1 when the beacon is disabled, and the scheduler logs every non-zero exit as an error. With CACHET_BEACON=false, every installation got a "Scheduled command [...] cachet:beacon failed with exit code [1]" error in its log each day. Only run the scheduled event when the beacon is enabled. --- src/CachetCoreServiceProvider.php | 2 +- tests/Feature/ProviderConfigTest.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/CachetCoreServiceProvider.php b/src/CachetCoreServiceProvider.php index 4b9b8327..01ab9ead 100644 --- a/src/CachetCoreServiceProvider.php +++ b/src/CachetCoreServiceProvider.php @@ -324,7 +324,7 @@ private function registerSchedules(): void $schedule = $this->app->make(\Illuminate\Console\Scheduling\Schedule::class); $demoMode = fn () => Cachet::demoMode(); - $schedule->command('cachet:beacon')->daily(); + $schedule->command('cachet:beacon')->daily()->when(fn () => config('cachet.beacon')); $schedule->command('cachet:notify-long-running-incidents')->hourly(); diff --git a/tests/Feature/ProviderConfigTest.php b/tests/Feature/ProviderConfigTest.php index 92086108..ca7e8af9 100644 --- a/tests/Feature/ProviderConfigTest.php +++ b/tests/Feature/ProviderConfigTest.php @@ -17,6 +17,15 @@ expect($commands->filter(fn (string $command) => str_contains($command, 'cachet:beacon')))->not->toBeEmpty(); }); +it('only runs the beacon schedule when the beacon is enabled', function (bool $enabled) { + config()->set('cachet.beacon', $enabled); + + $event = collect(app(Schedule::class)->events()) + ->first(fn ($event) => str_contains($event->command ?? '', 'cachet:beacon')); + + expect($event->filtersPass(app()))->toBe($enabled); +})->with([true, false]); + it('configures safe image upload defaults', function () { expect(config('cachet.uploads')) ->disk->toBe('public')