Make document reclassify command revalidation optional
This commit is contained in:
@@ -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;
|
||||
foreach ($articles as $article) {
|
||||
if ($article->isPublished()) {
|
||||
SiteRevalidationService::revalidateArticle($article->slug);
|
||||
$revalidated++;
|
||||
$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() || ! $canRevalidate) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$revalidateServiceClass::revalidateArticle($article->slug);
|
||||
$revalidated++;
|
||||
}
|
||||
|
||||
$this->newLine();
|
||||
|
||||
Reference in New Issue
Block a user