what the fuck

This commit is contained in:
boris committed 2026-04-02 13:46:07 +01:00
1 parent c1b1c2f372
commit 72a99a5bcd
69 files changed
+7519 -558

No files matched your search

@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace App\Command;
use App\Service\ExternalProviderManager;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
#[AsCommand(
name: 'app:sync-external-provider',
description: 'Applies effective external provider and resets catalog if provider changed.'
)]
class SyncExternalProviderCommand extends Command
{
public function __construct(
private readonly ExternalProviderManager $providerManager,
) {
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$result = $this->providerManager->syncEffectiveProviderAtStartup();
if ($result['reset']) {
$io->warning(sprintf(
'External provider changed from %s to %s. Reset catalog: deleted %d albums and %d reviews.',
$result['previous_provider'],
$result['effective_provider'],
$result['albums'],
$result['reviews']
));
return Command::SUCCESS;
}
$io->success(sprintf(
'External provider unchanged (%s). Catalog reset not required.',
$result['effective_provider']
));
return Command::SUCCESS;
}
}