diff --git a/EMS/core-bundle/src/Command/CleanAssetCommand.php b/EMS/core-bundle/src/Command/CleanAssetCommand.php index f53122651..2ef7debb0 100644 --- a/EMS/core-bundle/src/Command/CleanAssetCommand.php +++ b/EMS/core-bundle/src/Command/CleanAssetCommand.php @@ -4,6 +4,7 @@ use Doctrine\Bundle\DoctrineBundle\Registry; use Doctrine\ORM\EntityManager; +use EMS\CommonBundle\Common\Command\AbstractCommand; use EMS\CoreBundle\Entity\Revision; use EMS\CoreBundle\Entity\UploadedAsset; use EMS\CoreBundle\Repository\RevisionRepository; @@ -14,7 +15,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -class CleanAssetCommand extends EmsCommand +class CleanAssetCommand extends AbstractCommand { protected static $defaultName = 'ems:asset:clean'; @@ -37,8 +38,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int /** @var RevisionRepository $revRepo */ $revRepo = $em->getRepository(Revision::class); - $this->formatStyles($output); - $progress = new ProgressBar($output, $repository->countHashes()); $progress->start(); diff --git a/EMS/core-bundle/src/Command/EmsCommand.php b/EMS/core-bundle/src/Command/EmsCommand.php deleted file mode 100644 index dc1327aba..000000000 --- a/EMS/core-bundle/src/Command/EmsCommand.php +++ /dev/null @@ -1,17 +0,0 @@ -getFormatter()->setStyle('error', new OutputFormatterStyle('red', 'yellow', ['bold'])); - $output->getFormatter()->setStyle('comment', new OutputFormatterStyle('yellow', null, ['bold'])); - $output->getFormatter()->setStyle('notice', new OutputFormatterStyle('blue', null)); - } -} diff --git a/EMS/core-bundle/src/Command/ExtractAssetCommand.php b/EMS/core-bundle/src/Command/ExtractAssetCommand.php index a426b6534..d8184c82c 100644 --- a/EMS/core-bundle/src/Command/ExtractAssetCommand.php +++ b/EMS/core-bundle/src/Command/ExtractAssetCommand.php @@ -2,6 +2,7 @@ namespace EMS\CoreBundle\Command; +use EMS\CommonBundle\Common\Command\AbstractCommand; use EMS\CommonBundle\Storage\StorageManager; use EMS\CoreBundle\Service\AssetExtractorService; use Psr\Log\LoggerInterface; @@ -12,7 +13,7 @@ use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\SplFileInfo; -class ExtractAssetCommand extends EmsCommand +class ExtractAssetCommand extends AbstractCommand { protected static $defaultName = 'ems:asset:extract'; diff --git a/EMS/core-bundle/src/Command/IndexFileCommand.php b/EMS/core-bundle/src/Command/IndexFileCommand.php index 2c312e41e..8b758f935 100644 --- a/EMS/core-bundle/src/Command/IndexFileCommand.php +++ b/EMS/core-bundle/src/Command/IndexFileCommand.php @@ -5,6 +5,7 @@ use Doctrine\Bundle\DoctrineBundle\Registry; use Doctrine\DBAL\Connection; use Doctrine\ORM\EntityManager; +use EMS\CommonBundle\Common\Command\AbstractCommand; use EMS\CommonBundle\Helper\EmsFields; use EMS\CoreBundle\Entity\Revision; use EMS\CoreBundle\Repository\RevisionRepository; @@ -21,7 +22,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; -class IndexFileCommand extends EmsCommand +class IndexFileCommand extends AbstractCommand { protected static $defaultName = 'ems:revisions:index-file-fields'; /** @var string */ diff --git a/EMS/core-bundle/src/Command/RebuildCommand.php b/EMS/core-bundle/src/Command/RebuildCommand.php index 6e92909f3..6b519425b 100644 --- a/EMS/core-bundle/src/Command/RebuildCommand.php +++ b/EMS/core-bundle/src/Command/RebuildCommand.php @@ -4,6 +4,7 @@ use Doctrine\Bundle\DoctrineBundle\Registry; use Doctrine\Persistence\ObjectManager; +use EMS\CommonBundle\Common\Command\AbstractCommand; use EMS\CommonBundle\Service\ElasticaService; use EMS\CoreBundle\Entity\ContentType; use EMS\CoreBundle\Entity\Environment; @@ -19,7 +20,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -class RebuildCommand extends EmsCommand +class RebuildCommand extends AbstractCommand { public const ALL = 'all'; protected static $defaultName = self::COMMAND; @@ -82,7 +83,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->aliasService->build(); $this->yellowOk = true === $input->getOption('yellow-ok'); $this->all = true === $input->getOption(self::ALL); - $this->formatStyles($output); $this->waitFor($this->yellowOk, $output); $this->bulkSize = \intval($input->getOption('bulk-size')); diff --git a/EMS/core-bundle/src/Command/ReindexCommand.php b/EMS/core-bundle/src/Command/ReindexCommand.php index 77e9c7490..04f0e10c3 100644 --- a/EMS/core-bundle/src/Command/ReindexCommand.php +++ b/EMS/core-bundle/src/Command/ReindexCommand.php @@ -4,6 +4,7 @@ use Doctrine\Bundle\DoctrineBundle\Registry; use Doctrine\ORM\EntityManager; +use EMS\CommonBundle\Common\Command\AbstractCommand; use EMS\CommonBundle\Helper\EmsFields; use EMS\CoreBundle\Elasticsearch\Bulker; use EMS\CoreBundle\Entity\ContentType; @@ -22,7 +23,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -class ReindexCommand extends EmsCommand +class ReindexCommand extends AbstractCommand { protected static $defaultName = 'ems:environment:reindex'; private int $count = 0; @@ -76,7 +77,6 @@ protected function configure(): void protected function execute(InputInterface $input, OutputInterface $output): int { - $this->formatStyles($output); $name = $input->getArgument('name'); $index = $input->getArgument('index'); $signData = true === $input->getOption('sign-data'); @@ -209,21 +209,4 @@ public function reindex(string $name, ContentType $contentType, ?string $index, $output->writeln('WARNING: Environment named '.$name.' not found'); } } - - /** - * @param array $response - */ - public function treatBulkResponse(array $response): void - { - foreach ($response['items'] as $item) { - if (isset($item['index']['error'])) { - ++$this->error; - $this->logger->warning('log.reindex.revision.error', [ - EmsFields::LOG_OUUID_FIELD => $item['index']['_id'], - ]); - } else { - ++$this->count; - } - } - } } diff --git a/EMS/core-bundle/src/Command/SynchronizeAssetCommand.php b/EMS/core-bundle/src/Command/SynchronizeAssetCommand.php index 912c2b073..b10716bf0 100644 --- a/EMS/core-bundle/src/Command/SynchronizeAssetCommand.php +++ b/EMS/core-bundle/src/Command/SynchronizeAssetCommand.php @@ -4,6 +4,7 @@ use Doctrine\Bundle\DoctrineBundle\Registry; use Doctrine\ORM\EntityManager; +use EMS\CommonBundle\Common\Command\AbstractCommand; use EMS\CommonBundle\Storage\NotFoundException; use EMS\CoreBundle\Entity\UploadedAsset; use EMS\CoreBundle\Repository\UploadedAssetRepository; @@ -15,7 +16,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -class SynchronizeAssetCommand extends EmsCommand +class SynchronizeAssetCommand extends AbstractCommand { protected static $defaultName = 'ems:asset:synchronize'; /** @var string */ @@ -40,8 +41,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int /** @var UploadedAssetRepository $repository */ $repository = $em->getRepository(UploadedAsset::class); - $this->formatStyles($output); - $storagesList = []; foreach ($this->fileService->getHealthStatuses() as $storageName => $health) { if ($health) { diff --git a/EMS/core-bundle/src/Command/UpdateMetaFieldCommand.php b/EMS/core-bundle/src/Command/UpdateMetaFieldCommand.php index 2b10b0acc..53ee70b34 100644 --- a/EMS/core-bundle/src/Command/UpdateMetaFieldCommand.php +++ b/EMS/core-bundle/src/Command/UpdateMetaFieldCommand.php @@ -4,6 +4,7 @@ use Doctrine\Bundle\DoctrineBundle\Registry; use Doctrine\ORM\EntityManager; +use EMS\CommonBundle\Common\Command\AbstractCommand; use EMS\CoreBundle\Entity\Environment; use EMS\CoreBundle\Entity\Revision; use EMS\CoreBundle\Exception\NotLockedException; @@ -16,7 +17,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -class UpdateMetaFieldCommand extends EmsCommand +class UpdateMetaFieldCommand extends AbstractCommand { protected static $defaultName = 'ems:environment:updatemetafield';