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) <noreply@anthropic.com>
This commit is contained in:
@@ -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) => {
|
||||
|
||||
@@ -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<string> $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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user