Skip to content

Commit

Permalink
IBX-8224: Dropped BackwardCompatibleCommand usage (#386)
Browse files Browse the repository at this point in the history
For more details see https://issues.ibexa.co/browse/IBX-8224 and #386

Key changes:

* IBX-8224: Dropped BackwardCompatibleCommand usage
  • Loading branch information
ViniTou authored Jun 27, 2024
1 parent c93fddd commit 2c706ae
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 91 deletions.
8 changes: 1 addition & 7 deletions src/bundle/Core/Command/CheckURLsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -118,9 +117,4 @@ private function getTotalCount(): int

return $this->urlService->findUrls($query)->totalCount;
}

public function getDeprecatedAliases(): array
{
return ['ezplatform:check-urls'];
}
}
11 changes: 1 addition & 10 deletions src/bundle/Core/Command/CleanupVersionsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,21 @@
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 = <<<EOT
<error>Before you continue:</error>
- Make sure to back up your database.
- Take the installation offline. The database should not be modified while the script is being executed.
- Run this command without memory limit.
- Run this command in production environment using <info>--env=prod</info>
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,
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -298,9 +294,4 @@ private function mapStatusToVersionInfoStatus($status)
)
);
}

public function getDeprecatedAliases(): array
{
return ['ezplatform:content:cleanup-versions'];
}
}
8 changes: 1 addition & 7 deletions src/bundle/Core/Command/CopySubtreeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -69,7 +69,6 @@ protected function configure()
{
$this
->setName('ibexa:copy-subtree')
->setAliases($this->getDeprecatedAliases())
->addArgument(
'source-location-id',
InputArgument::REQUIRED,
Expand Down Expand Up @@ -183,9 +182,4 @@ protected function getAllChildrenCount(Location $location): int

return $searchResults->totalCount;
}

public function getDeprecatedAliases(): array
{
return ['ezplatform:copy-subtree'];
}
}
9 changes: 2 additions & 7 deletions src/bundle/Core/Command/DebugConfigResolverCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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',
Expand Down Expand Up @@ -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'];
}
}
8 changes: 1 addition & 7 deletions src/bundle/Core/Command/DeleteContentTranslationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -196,9 +195,4 @@ static function ($versionLanguageCode) use ($languageCode) {
$contentMetadataUpdateStruct
)->contentInfo;
}

public function getDeprecatedAliases(): array
{
return ['ezplatform:delete-content-translation'];
}
}
9 changes: 1 addition & 8 deletions src/bundle/Core/Command/RegenerateUrlAliasesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <<<EOT
<error>Before you continue:</error>
- Make sure to back up your database.
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -331,9 +329,4 @@ private function regenerateSystemUrlAliases(
$output->writeln('');
$output->writeln('<info>Done.</info>');
}

public function getDeprecatedAliases(): array
{
return ['ezplatform:urls:regenerate-aliases'];
}
}
8 changes: 1 addition & 7 deletions src/bundle/Core/Command/ReindexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -474,9 +473,4 @@ private function getNumberOfCPUCores()

return $cores;
}

public function getDeprecatedAliases(): array
{
return ['ezplatform:reindex'];
}
}
8 changes: 1 addition & 7 deletions src/bundle/Core/Command/ResizeOriginalImagesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -105,7 +105,6 @@ protected function configure()
{
$this
->setName('ibexa:images:resize-original')
->setAliases($this->getDeprecatedAliases())
->addArgument(
'imageFieldIdentifier',
InputArgument::REQUIRED,
Expand Down Expand Up @@ -309,9 +308,4 @@ private function store(BinaryInterface $binary, Value $image): BinaryFile

return $newBinaryFile;
}

public function getDeprecatedAliases(): array
{
return ['ezplatform:images:resize-original'];
}
}
8 changes: 1 addition & 7 deletions src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -503,9 +502,4 @@ private function dateStringToTimestamp($dateString)

return $date->getTimestamp();
}

public function getDeprecatedAliases(): array
{
return ['ezplatform:timestamps:to-utc'];
}
}
9 changes: 1 addition & 8 deletions src/bundle/IO/Command/MigrateFilesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 <from_metadata_handler>,<from_binarydata_handler>')
->addOption('to', null, InputOption::VALUE_REQUIRED, 'Migrate to <to_metadata_handler>,<to_binarydata_handler>')
Expand Down Expand Up @@ -319,9 +317,4 @@ protected function migrateFiles(
]);
}
}

public function getDeprecatedAliases(): array
{
return ['ezplatform:io:migrate-files'];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -63,7 +62,7 @@ public function __construct(
protected function configure()
{
$this->setName('ibexa:install');
$this->setAliases($this->getDeprecatedAliases());

$this->addArgument(
'type',
InputArgument::OPTIONAL,
Expand Down Expand Up @@ -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'];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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'];
}
}

0 comments on commit 2c706ae

Please sign in to comment.