From 2c706aef2fa4bdbb5e582adb630b3b95eb75296b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Parafi=C5=84ski?= Date: Thu, 27 Jun 2024 11:54:09 +0200 Subject: [PATCH] IBX-8224: Dropped BackwardCompatibleCommand usage (#386) For more details see https://issues.ibexa.co/browse/IBX-8224 and https://github.com/ibexa/core/pull/386 Key changes: * IBX-8224: Dropped BackwardCompatibleCommand usage --- src/bundle/Core/Command/CheckURLsCommand.php | 8 +------- src/bundle/Core/Command/CleanupVersionsCommand.php | 11 +---------- src/bundle/Core/Command/CopySubtreeCommand.php | 8 +------- .../Core/Command/DebugConfigResolverCommand.php | 9 ++------- .../Core/Command/DeleteContentTranslationCommand.php | 8 +------- .../Core/Command/RegenerateUrlAliasesCommand.php | 9 +-------- src/bundle/Core/Command/ReindexCommand.php | 8 +------- .../Core/Command/ResizeOriginalImagesCommand.php | 8 +------- .../Core/Command/UpdateTimestampsToUTCCommand.php | 8 +------- src/bundle/IO/Command/MigrateFilesCommand.php | 9 +-------- .../Command/InstallPlatformCommand.php | 10 ++-------- .../Command/ValidatePasswordHashesCommand.php | 9 +-------- 12 files changed, 14 insertions(+), 91 deletions(-) diff --git a/src/bundle/Core/Command/CheckURLsCommand.php b/src/bundle/Core/Command/CheckURLsCommand.php index b9b5b3ee26..2589dde7cb 100644 --- a/src/bundle/Core/Command/CheckURLsCommand.php +++ b/src/bundle/Core/Command/CheckURLsCommand.php @@ -22,7 +22,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -class CheckURLsCommand extends Command implements BackwardCompatibleCommand +class CheckURLsCommand extends Command { private const DEFAULT_ITERATION_COUNT = 50; private const DEFAULT_REPOSITORY_USER = 'admin'; @@ -55,7 +55,6 @@ public function __construct( public function configure(): void { - $this->setAliases($this->getDeprecatedAliases()); $this->setDescription('Checks validity of external URLs'); $this->addOption( 'iteration-count', @@ -118,9 +117,4 @@ private function getTotalCount(): int return $this->urlService->findUrls($query)->totalCount; } - - public function getDeprecatedAliases(): array - { - return ['ezplatform:check-urls']; - } } diff --git a/src/bundle/Core/Command/CleanupVersionsCommand.php b/src/bundle/Core/Command/CleanupVersionsCommand.php index 3168db825d..e964b237c1 100644 --- a/src/bundle/Core/Command/CleanupVersionsCommand.php +++ b/src/bundle/Core/Command/CleanupVersionsCommand.php @@ -19,11 +19,10 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -class CleanupVersionsCommand extends Command implements BackwardCompatibleCommand +class CleanupVersionsCommand extends Command { public const DEFAULT_REPOSITORY_USER = 'admin'; public const DEFAULT_EXCLUDED_CONTENT_TYPES = 'user'; - public const BEFORE_RUNNING_HINTS = <<Before you continue: - Make sure to back up your database. @@ -31,12 +30,10 @@ class CleanupVersionsCommand extends Command implements BackwardCompatibleComman - Run this command without memory limit. - Run this command in production environment using --env=prod EOT; - public const VERSION_DRAFT = 'draft'; public const VERSION_ARCHIVED = 'archived'; public const VERSION_PUBLISHED = 'published'; public const VERSION_ALL = 'all'; - public const VERSION_STATUS = [ self::VERSION_DRAFT => VersionInfo::STATUS_DRAFT, self::VERSION_ARCHIVED => VersionInfo::STATUS_ARCHIVED, @@ -66,7 +63,6 @@ protected function configure() $beforeRunningHints = self::BEFORE_RUNNING_HINTS; $this ->setName('ibexa:content:cleanup-versions') - ->setAliases($this->getDeprecatedAliases()) ->setDescription('Removes unwanted content versions. Keeps the published version untouched. By default, also keeps the last archived/draft version.') ->addOption( 'status', @@ -298,9 +294,4 @@ private function mapStatusToVersionInfoStatus($status) ) ); } - - public function getDeprecatedAliases(): array - { - return ['ezplatform:content:cleanup-versions']; - } } diff --git a/src/bundle/Core/Command/CopySubtreeCommand.php b/src/bundle/Core/Command/CopySubtreeCommand.php index 3e2c00c2da..c2033da4b8 100644 --- a/src/bundle/Core/Command/CopySubtreeCommand.php +++ b/src/bundle/Core/Command/CopySubtreeCommand.php @@ -26,7 +26,7 @@ /** * Console command for deep copying subtree from one location to another. */ -class CopySubtreeCommand extends Command implements BackwardCompatibleCommand +class CopySubtreeCommand extends Command { /** @var \Ibexa\Contracts\Core\Repository\LocationService */ private $locationService; @@ -69,7 +69,6 @@ protected function configure() { $this ->setName('ibexa:copy-subtree') - ->setAliases($this->getDeprecatedAliases()) ->addArgument( 'source-location-id', InputArgument::REQUIRED, @@ -183,9 +182,4 @@ protected function getAllChildrenCount(Location $location): int return $searchResults->totalCount; } - - public function getDeprecatedAliases(): array - { - return ['ezplatform:copy-subtree']; - } } diff --git a/src/bundle/Core/Command/DebugConfigResolverCommand.php b/src/bundle/Core/Command/DebugConfigResolverCommand.php index f9ba80ffcc..53fa71216f 100644 --- a/src/bundle/Core/Command/DebugConfigResolverCommand.php +++ b/src/bundle/Core/Command/DebugConfigResolverCommand.php @@ -17,7 +17,7 @@ use Symfony\Component\VarDumper\Cloner\VarCloner; use Symfony\Component\VarDumper\Dumper\CliDumper; -class DebugConfigResolverCommand extends Command implements BackwardCompatibleCommand +class DebugConfigResolverCommand extends Command { /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ private $configResolver; @@ -41,7 +41,7 @@ public function __construct( public function configure() { $this->setName('ibexa:debug:config-resolver'); - $this->setAliases(array_merge(['ibexa:debug:config'], $this->getDeprecatedAliases())); + $this->setAliases(['ibexa:debug:config']); $this->setDescription('Debugs / Retrieves a parameter from the Config Resolver'); $this->addArgument( 'parameter', @@ -113,9 +113,4 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 0; } - - public function getDeprecatedAliases(): array - { - return ['ezplatform:debug:config-resolver', 'ezplatform:debug:config']; - } } diff --git a/src/bundle/Core/Command/DeleteContentTranslationCommand.php b/src/bundle/Core/Command/DeleteContentTranslationCommand.php index fef5088ba0..fc18aca841 100644 --- a/src/bundle/Core/Command/DeleteContentTranslationCommand.php +++ b/src/bundle/Core/Command/DeleteContentTranslationCommand.php @@ -22,7 +22,7 @@ /** * Console Command which deletes a given Translation from all the Versions of a given Content Item. */ -class DeleteContentTranslationCommand extends Command implements BackwardCompatibleCommand +class DeleteContentTranslationCommand extends Command { /** @var \Ibexa\Contracts\Core\Repository\Repository */ private $repository; @@ -52,7 +52,6 @@ protected function configure() { $this ->setName('ibexa:delete-content-translation') - ->setAliases($this->getDeprecatedAliases()) ->addArgument('content-id', InputArgument::REQUIRED, 'Content Object Id') ->addArgument( 'language-code', @@ -196,9 +195,4 @@ static function ($versionLanguageCode) use ($languageCode) { $contentMetadataUpdateStruct )->contentInfo; } - - public function getDeprecatedAliases(): array - { - return ['ezplatform:delete-content-translation']; - } } diff --git a/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php b/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php index ee5f216e40..6591bfa265 100644 --- a/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php +++ b/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php @@ -24,10 +24,9 @@ * The ezplatform:urls:regenerate-aliases Symfony command implementation. * Recreates system URL aliases for all existing Locations and cleanups corrupted URL alias nodes. */ -class RegenerateUrlAliasesCommand extends Command implements BackwardCompatibleCommand +class RegenerateUrlAliasesCommand extends Command { public const DEFAULT_ITERATION_COUNT = 1000; - public const BEFORE_RUNNING_HINTS = <<Before you continue: - Make sure to back up your database. @@ -63,7 +62,6 @@ protected function configure() $beforeRunningHints = self::BEFORE_RUNNING_HINTS; $this ->setName('ibexa:urls:regenerate-aliases') - ->setAliases($this->getDeprecatedAliases()) ->setDescription( 'Regenerates Location URL aliases (autogenerated) and cleans up custom Location ' . 'and global URL aliases stored in the Legacy Storage Engine' @@ -331,9 +329,4 @@ private function regenerateSystemUrlAliases( $output->writeln(''); $output->writeln('Done.'); } - - public function getDeprecatedAliases(): array - { - return ['ezplatform:urls:regenerate-aliases']; - } } diff --git a/src/bundle/Core/Command/ReindexCommand.php b/src/bundle/Core/Command/ReindexCommand.php index e086e0083f..68f8437310 100644 --- a/src/bundle/Core/Command/ReindexCommand.php +++ b/src/bundle/Core/Command/ReindexCommand.php @@ -27,7 +27,7 @@ use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process; -class ReindexCommand extends Command implements BackwardCompatibleCommand +class ReindexCommand extends Command { /** @var \Ibexa\Core\Search\Common\Indexer|\Ibexa\Core\Search\Common\IncrementalIndexer */ private $searchIndexer; @@ -110,7 +110,6 @@ protected function configure() { $this ->setName('ibexa:reindex') - ->setAliases($this->getDeprecatedAliases()) ->setDescription('Recreates or refreshes the search engine index') ->addOption( 'iteration-count', @@ -474,9 +473,4 @@ private function getNumberOfCPUCores() return $cores; } - - public function getDeprecatedAliases(): array - { - return ['ezplatform:reindex']; - } } diff --git a/src/bundle/Core/Command/ResizeOriginalImagesCommand.php b/src/bundle/Core/Command/ResizeOriginalImagesCommand.php index 9970584765..c0ee18b9eb 100644 --- a/src/bundle/Core/Command/ResizeOriginalImagesCommand.php +++ b/src/bundle/Core/Command/ResizeOriginalImagesCommand.php @@ -36,7 +36,7 @@ /** * This command resizes original images stored in ezimage FieldType in given ContentType using the selected filter. */ -class ResizeOriginalImagesCommand extends Command implements BackwardCompatibleCommand +class ResizeOriginalImagesCommand extends Command { public const DEFAULT_ITERATION_COUNT = 25; public const DEFAULT_REPOSITORY_USER = 'admin'; @@ -105,7 +105,6 @@ protected function configure() { $this ->setName('ibexa:images:resize-original') - ->setAliases($this->getDeprecatedAliases()) ->addArgument( 'imageFieldIdentifier', InputArgument::REQUIRED, @@ -309,9 +308,4 @@ private function store(BinaryInterface $binary, Value $image): BinaryFile return $newBinaryFile; } - - public function getDeprecatedAliases(): array - { - return ['ezplatform:images:resize-original']; - } } diff --git a/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php b/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php index ecc69e1669..babbe4e9cd 100644 --- a/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php +++ b/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php @@ -23,7 +23,7 @@ use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process; -class UpdateTimestampsToUTCCommand extends Command implements BackwardCompatibleCommand +class UpdateTimestampsToUTCCommand extends Command { public const MAX_TIMESTAMP_VALUE = 2147483647; public const DEFAULT_ITERATION_COUNT = 100; @@ -67,7 +67,6 @@ protected function configure() { $this ->setName('ibexa:timestamps:to-utc') - ->setAliases($this->getDeprecatedAliases()) ->setDescription('Updates ezdate and ezdatetime timestamps to UTC') ->addArgument( 'timezone', @@ -503,9 +502,4 @@ private function dateStringToTimestamp($dateString) return $date->getTimestamp(); } - - public function getDeprecatedAliases(): array - { - return ['ezplatform:timestamps:to-utc']; - } } diff --git a/src/bundle/IO/Command/MigrateFilesCommand.php b/src/bundle/IO/Command/MigrateFilesCommand.php index 02dc895727..be56dc3656 100644 --- a/src/bundle/IO/Command/MigrateFilesCommand.php +++ b/src/bundle/IO/Command/MigrateFilesCommand.php @@ -7,7 +7,6 @@ namespace Ibexa\Bundle\IO\Command; -use Ibexa\Bundle\Core\Command\BackwardCompatibleCommand; use Ibexa\Bundle\IO\Migration\FileListerRegistry; use Ibexa\Bundle\IO\Migration\FileMigratorInterface; use Symfony\Component\Console\Command\Command; @@ -17,7 +16,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; -final class MigrateFilesCommand extends Command implements BackwardCompatibleCommand +final class MigrateFilesCommand extends Command { /** @var mixed Configuration for metadata handlers */ private $configuredMetadataHandlers; @@ -63,7 +62,6 @@ protected function configure() { $this ->setName('ibexa:io:migrate-files') - ->setAliases($this->getDeprecatedAliases()) ->setDescription('Migrates files from one IO repository to another') ->addOption('from', null, InputOption::VALUE_REQUIRED, 'Migrate from ,') ->addOption('to', null, InputOption::VALUE_REQUIRED, 'Migrate to ,') @@ -319,9 +317,4 @@ protected function migrateFiles( ]); } } - - public function getDeprecatedAliases(): array - { - return ['ezplatform:io:migrate-files']; - } } diff --git a/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php b/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php index a1d6a5a98a..a754a96419 100644 --- a/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php +++ b/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php @@ -8,7 +8,6 @@ namespace Ibexa\Bundle\RepositoryInstaller\Command; use Doctrine\DBAL\Connection; -use Ibexa\Bundle\Core\Command\BackwardCompatibleCommand; use Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Console\Command\Command; @@ -21,7 +20,7 @@ use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process; -final class InstallPlatformCommand extends Command implements BackwardCompatibleCommand +final class InstallPlatformCommand extends Command { /** @var \Doctrine\DBAL\Connection */ private $connection; @@ -63,7 +62,7 @@ public function __construct( protected function configure() { $this->setName('ibexa:install'); - $this->setAliases($this->getDeprecatedAliases()); + $this->addArgument( 'type', InputArgument::OPTIONAL, @@ -273,9 +272,4 @@ private function executeCommand(OutputInterface $output, $cmd, $timeout = 300) throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command.', escapeshellarg($cmd))); } } - - public function getDeprecatedAliases(): array - { - return ['ezplatform:install']; - } } diff --git a/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php b/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php index b1aaded552..d077dbe4fc 100644 --- a/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php +++ b/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php @@ -7,14 +7,13 @@ namespace Ibexa\Bundle\RepositoryInstaller\Command; -use Ibexa\Bundle\Core\Command\BackwardCompatibleCommand; use Ibexa\Contracts\Core\Repository\PasswordHashService; use Ibexa\Core\FieldType\User\UserStorage; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -final class ValidatePasswordHashesCommand extends Command implements BackwardCompatibleCommand +final class ValidatePasswordHashesCommand extends Command { /** @var \Ibexa\Core\FieldType\User\UserStorage */ private $userStorage; @@ -35,7 +34,6 @@ public function __construct( protected function configure() { $this->setName('ibexa:user:validate-password-hashes'); - $this->setAliases($this->getDeprecatedAliases()); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -53,9 +51,4 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::SUCCESS; } - - public function getDeprecatedAliases(): array - { - return ['ezplatform:user:validate-password-hashes']; - } }