From 63f52d704e44aca0ff626649c67ca3e03c371373 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Thu, 28 Nov 2024 19:24:49 +0000 Subject: [PATCH] Throw an error when running `static:clear` when static caching is disabled --- src/Console/Commands/StaticClear.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Console/Commands/StaticClear.php b/src/Console/Commands/StaticClear.php index 98732f7812..3aaecfe94d 100644 --- a/src/Console/Commands/StaticClear.php +++ b/src/Console/Commands/StaticClear.php @@ -33,6 +33,12 @@ class StaticClear extends Command */ public function handle() { + if (! config('statamic.static_caching.strategy')) { + $this->components->error('Static caching is not enabled.'); + + return 1; + } + spin(callback: fn () => StaticCache::flush(), message: 'Clearing the static page cache...'); $this->components->info('Your static page cache is now so very, very empty.');