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\Article;
|
||||||
use App\Models\ArticleCategory;
|
use App\Models\ArticleCategory;
|
||||||
use App\Services\SiteRevalidationService;
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
@@ -121,11 +120,20 @@ class ReclassifyDocumentContent extends Command
|
|||||||
});
|
});
|
||||||
|
|
||||||
$revalidated = 0;
|
$revalidated = 0;
|
||||||
foreach ($articles as $article) {
|
$revalidateServiceClass = '\\App\\Services\\SiteRevalidationService';
|
||||||
if ($article->isPublished()) {
|
$canRevalidate = class_exists($revalidateServiceClass);
|
||||||
SiteRevalidationService::revalidateArticle($article->slug);
|
|
||||||
$revalidated++;
|
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();
|
$this->newLine();
|
||||||
|
|||||||
Reference in New Issue
Block a user