From 097e3326086bb66c5b44ce705a04ef31186015a4 Mon Sep 17 00:00:00 2001 From: gbanyan Date: Tue, 10 Feb 2026 20:04:21 +0800 Subject: [PATCH] Make document reclassify command revalidation optional --- .../Commands/ReclassifyDocumentContent.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/ReclassifyDocumentContent.php b/app/Console/Commands/ReclassifyDocumentContent.php index fbe08e1..71ea2f1 100644 --- a/app/Console/Commands/ReclassifyDocumentContent.php +++ b/app/Console/Commands/ReclassifyDocumentContent.php @@ -4,7 +4,6 @@ namespace App\Console\Commands; use App\Models\Article; use App\Models\ArticleCategory; -use App\Services\SiteRevalidationService; use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; @@ -121,11 +120,20 @@ class ReclassifyDocumentContent extends Command }); $revalidated = 0; + $revalidateServiceClass = '\\App\\Services\\SiteRevalidationService'; + $canRevalidate = class_exists($revalidateServiceClass); + + if (! $canRevalidate) { + $this->warn('SiteRevalidationService not found. Skipping cache revalidation.'); + } + foreach ($articles as $article) { - if ($article->isPublished()) { - SiteRevalidationService::revalidateArticle($article->slug); - $revalidated++; + if (! $article->isPublished() || ! $canRevalidate) { + continue; } + + $revalidateServiceClass::revalidateArticle($article->slug); + $revalidated++; } $this->newLine();