Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanly remove anyway overridden command controllers #434

Merged
merged 1 commit into from
Mar 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Classes/Command/ExtensionCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private function setupExtensions(array $packages, array $activatedExtensionKeys
* As an additional benefit no caches are flushed, which significantly improves performance of this command
* and avoids unnecessary cache clearing.
*
* @see extensionmanager:extension:setup
* @see typo3_console:extension:setup
* @see typo3_console:install:generatepackagestates
* @see typo3_console:cache:flush
*/
Expand Down
2 changes: 0 additions & 2 deletions Classes/Core/Booting/Scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@ public static function provideCleanClassImplementations(ConsoleBootstrap $bootst
self::registerImplementation(\Helhum\Typo3Console\Database\Schema\SchemaUpdateInterface::class, \Helhum\Typo3Console\Database\Schema\LegacySchemaUpdate::class);
}
self::overrideImplementation(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, \Helhum\Typo3Console\Mvc\Cli\Command::class);
self::overrideImplementation(\TYPO3\CMS\Extbase\Command\HelpCommandController::class, \Helhum\Typo3Console\Command\HelpCommandController::class);
self::overrideImplementation(\TYPO3\CMS\Extensionmanager\Command\ExtensionCommandController::class, \Helhum\Typo3Console\Command\ExtensionCommandController::class);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerTypeConverter(\Helhum\Typo3Console\Property\TypeConverter\ArrayConverter::class);
}

Expand Down
16 changes: 14 additions & 2 deletions Classes/Mvc/Cli/CommandManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
*/

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Command\HelpCommandController;
use TYPO3\CMS\Extbase\Mvc\Cli\Command;
use TYPO3\CMS\Extensionmanager\Command\ExtensionCommandController;

/**
* Class CommandManager
Expand Down Expand Up @@ -56,8 +58,12 @@ protected function initialize()
*/
public function getCommandByIdentifier($commandIdentifier)
{
$commandIdentifier = strtolower(trim($commandIdentifier));
if ($commandIdentifier === 'help') {
$commandIdentifier = 'typo3_console:help:help';
}
if ($commandIdentifier === 'autocomplete') {
$commandIdentifier = 'extbase:help:autocomplete';
$commandIdentifier = 'typo3_console:help:autocomplete';
}
return parent::getCommandByIdentifier($commandIdentifier);
}
Expand All @@ -68,7 +74,10 @@ public function getCommandByIdentifier($commandIdentifier)
*/
public function getShortestIdentifierForCommand(Command $command)
{
if ($command->getCommandIdentifier() === 'extbase:help:autocomplete') {
if ($command->getCommandIdentifier() === 'typo3_console:help:help') {
return 'help';
}
if ($command->getCommandIdentifier() === 'typo3_console:help:autocomplete') {
return 'autocomplete';
}
return parent::getShortestIdentifierForCommand($command);
Expand All @@ -85,6 +94,9 @@ public function getAvailableCommands()
if ($this->availableCommands === null) {
$commandControllerRegistry = & $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'];
if (!empty($commandControllerRegistry) && is_array($commandControllerRegistry)) {
$commandControllerRegistry = array_filter($commandControllerRegistry, function ($value) {
return !in_array($value, [ExtensionCommandController::class, HelpCommandController::class], true);
});
$commandControllerRegistry = array_merge($commandControllerRegistry, $this->commandControllers);
} else {
$commandControllerRegistry = $this->commandControllers;
Expand Down
2 changes: 2 additions & 0 deletions Configuration/Console/Commands.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
return [
'controllers' => [
\Helhum\Typo3Console\Command\HelpCommandController::class,
\Helhum\Typo3Console\Command\CacheCommandController::class,
\Helhum\Typo3Console\Command\BackendCommandController::class,
\Helhum\Typo3Console\Command\SchedulerCommandController::class,
Expand All @@ -10,6 +11,7 @@
\Helhum\Typo3Console\Command\DatabaseCommandController::class,
\Helhum\Typo3Console\Command\ConfigurationCommandController::class,
\Helhum\Typo3Console\Command\FrontendCommandController::class,
\Helhum\Typo3Console\Command\ExtensionCommandController::class,
],
'runLevels' => [
'typo3_console:install:databasedata' => \Helhum\Typo3Console\Core\Booting\RunLevel::LEVEL_MINIMAL ,
Expand Down