From 61946f724efc5c42c32bb023d417edbc8fb85f74 Mon Sep 17 00:00:00 2001 From: Serreau Jovann Date: Thu, 26 Mar 2026 16:14:33 +0100 Subject: [PATCH] Fix scanner service worker CDN URL and clean up MeilisearchConsistencyCommand - Replace unpkg.com with cdn.jsdelivr.net in sw.js cache list - Fix sw.js scope to /scanner/ - Remove unused $indexes parameter from checkAllIndexes() - Extract duplicated " [%s] Index missing" literal to INDEX_MISSING_MSG constant Co-Authored-By: Claude Opus 4.6 (1M context) --- public/scanner/sw.js | 4 ++-- src/Command/MeilisearchConsistencyCommand.php | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/public/scanner/sw.js b/public/scanner/sw.js index 597e346..a157f27 100644 --- a/public/scanner/sw.js +++ b/public/scanner/sw.js @@ -1,7 +1,7 @@ const CACHE_NAME = 'scanner-v1'; const ASSETS = [ - '/scanner', - 'https://unpkg.com/html5-qrcode@2.3.8/html5-qrcode.min.js', + '/scanner/', + 'https://cdn.jsdelivr.net/npm/html5-qrcode@2.3.8/html5-qrcode.min.js', ]; self.addEventListener('install', (e) => { diff --git a/src/Command/MeilisearchConsistencyCommand.php b/src/Command/MeilisearchConsistencyCommand.php index 2e677c5..d6c4062 100644 --- a/src/Command/MeilisearchConsistencyCommand.php +++ b/src/Command/MeilisearchConsistencyCommand.php @@ -25,6 +25,8 @@ use Symfony\Component\Console\Style\SymfonyStyle; )] class MeilisearchConsistencyCommand extends Command { + private const INDEX_MISSING_MSG = ' [%s] Index missing'; + public function __construct( private MeilisearchService $meilisearch, private EntityManagerInterface $em, @@ -54,7 +56,7 @@ class MeilisearchConsistencyCommand extends Command return Command::FAILURE; } - [$totalOrphans, $totalMissing] = $this->checkAllIndexes($indexes, $fix, $io); + [$totalOrphans, $totalMissing] = $this->checkAllIndexes($fix, $io); $this->reportSummary($io, $totalOrphans, $totalMissing, $fix); @@ -62,11 +64,9 @@ class MeilisearchConsistencyCommand extends Command } /** - * @param list $indexes - * * @return array{int, int} */ - private function checkAllIndexes(array $indexes, bool $fix, SymfonyStyle $io): array + private function checkAllIndexes(bool $fix, SymfonyStyle $io): array { $totals = [0, 0]; @@ -160,7 +160,7 @@ class MeilisearchConsistencyCommand extends Command $indexExists = $this->meilisearch->indexExists($index); if (!$indexExists && !$fix) { - $io->text(sprintf(' [%s] Index missing', $index)); + $io->text(sprintf(self::INDEX_MISSING_MSG, $index)); return [0, 0]; } @@ -215,7 +215,7 @@ class MeilisearchConsistencyCommand extends Command $indexExists = $this->meilisearch->indexExists($index); if (!$indexExists && !$fix) { - $io->text(sprintf(' [%s] Index missing', $index)); + $io->text(sprintf(self::INDEX_MISSING_MSG, $index)); return [0, 0]; } @@ -257,7 +257,7 @@ class MeilisearchConsistencyCommand extends Command $indexExists = $this->meilisearch->indexExists($index); if (!$indexExists && !$fix) { - $io->text(sprintf(' [%s] Index missing', $index)); + $io->text(sprintf(self::INDEX_MISSING_MSG, $index)); return [0, 0]; }