From 851c162febae63682fb97bca77139291b5979ee3 Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Mon, 27 Mar 2017 12:13:03 +0200 Subject: [PATCH] [TASK] Deprecate cliKeys logic and cli_dispatch.phpsh entrypoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The way of calling CLI scripts from within TYPO3 via the "cliKeys" functionality and the typo3/cli_dispatch.phpsh entrypoint have been superseded by the new Symfony Console integration. All code related to this functionality has been marked as deprecated. Calling the CliRequestHandler (which is the main entry point for the cli_dispatch.phpsh) will trigger a deprecation message warning. Resolves: #80468 Releases: master Change-Id: Ib72ab93bee27421163c9117ebedcc0e97e17d41e Reviewed-on: https://review.typo3.org/52173 Reviewed-by: Frank Nägler <frank.naegler@typo3.org> Tested-by: Frank Nägler <frank.naegler@typo3.org> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- typo3/cli_dispatch.phpsh | 3 +- .../backend/Classes/Console/Application.php | 4 ++ .../Classes/Console/CliRequestHandler.php | 4 ++ .../backend/Resources/Private/Php/cli.php | 4 ++ .../Classes/Console/CommandRequestHandler.php | 2 + .../Configuration/DefaultConfiguration.php | 1 + ...neInterfaceCliKeysAndCli_dispatchphpsh.rst | 48 +++++++++++++++++++ typo3/sysext/extbase/ext_localconf.php | 1 + typo3/sysext/lowlevel/ext_localconf.php | 1 + typo3/sysext/scheduler/ext_localconf.php | 1 + 10 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Deprecation-80468-CommandLineInterfaceCliKeysAndCli_dispatchphpsh.rst diff --git a/typo3/cli_dispatch.phpsh b/typo3/cli_dispatch.phpsh index 7b8acac0ed63..57817392a7ca 100755 --- a/typo3/cli_dispatch.phpsh +++ b/typo3/cli_dispatch.phpsh @@ -1,4 +1,5 @@ #!/usr/bin/env php <?php - +// This entry-point is deprecated since TYPO3 v8 and will be removed in TYPO3 v9 +// Use the binary located typo3/sysext/core/bin/typo3 instead. require 'sysext/backend/Resources/Private/Php/cli.php'; diff --git a/typo3/sysext/backend/Classes/Console/Application.php b/typo3/sysext/backend/Classes/Console/Application.php index cc52d82836c8..edc09321a42b 100644 --- a/typo3/sysext/backend/Classes/Console/Application.php +++ b/typo3/sysext/backend/Classes/Console/Application.php @@ -18,6 +18,10 @@ use TYPO3\CMS\Core\Core\Bootstrap; /** * Entry point for the TYPO3 Command Line for Backend calls + * + * This class is @deprecated in favor of the Core-based CommandApplication, which has a different + * entry-point level, and has a different request handler out-of-the-box. This class will be removed + * in TYPO3 v9. */ class Application implements ApplicationInterface { diff --git a/typo3/sysext/backend/Classes/Console/CliRequestHandler.php b/typo3/sysext/backend/Classes/Console/CliRequestHandler.php index 6218dcfb181e..a623bde425c6 100644 --- a/typo3/sysext/backend/Classes/Console/CliRequestHandler.php +++ b/typo3/sysext/backend/Classes/Console/CliRequestHandler.php @@ -27,6 +27,8 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; * Resolves the "cliKey" which is registered inside $TYPO3_CONF_VARS[SC_OPTIONS][GLOBAL][cliKeys] * and includes the CLI-based script or exits if no valid "cliKey" is found. * Also logs into the system as a backend user which needs to be added to the database called _CLI_mymodule + * + * This class is deprecated in favor of the Core-based CommandRequestHandler, which uses Symfony Commands. */ class CliRequestHandler implements RequestHandlerInterface { @@ -54,6 +56,8 @@ class CliRequestHandler implements RequestHandlerInterface */ public function handleRequest(InputInterface $input) { + GeneralUtility::deprecationLog('Using cli_dispatch.phpsh as entry point for CLI commands has been marked ' + . 'as deprecated and will be removed in TYPO3 v9. Please use the new CLI entrypoint via /typo3/sysext/core/bin/typo3 instead.'); $output = GeneralUtility::makeInstance(ConsoleOutput::class); $exitCode = 0; diff --git a/typo3/sysext/backend/Resources/Private/Php/cli.php b/typo3/sysext/backend/Resources/Private/Php/cli.php index b5412ec3ed92..925c6c66454e 100644 --- a/typo3/sysext/backend/Resources/Private/Php/cli.php +++ b/typo3/sysext/backend/Resources/Private/Php/cli.php @@ -18,6 +18,10 @@ if (version_compare(PHP_VERSION, '7.0.0', '<')) { } /** + * -------------------------------------------------------------------------------- + * NOTE: This entry-point is deprecated since TYPO3 v8 and will be removed in + * TYPO3 v9. Use the binary located typo3/sysext/core/bin/typo3 instead. + * -------------------------------------------------------------------------------- * Command Line Interface module dispatcher * * This script takes a "cliKey" as first argument and uses that to dispatch diff --git a/typo3/sysext/core/Classes/Console/CommandRequestHandler.php b/typo3/sysext/core/Classes/Console/CommandRequestHandler.php index d3eb7a4eb434..27070f90a23f 100644 --- a/typo3/sysext/core/Classes/Console/CommandRequestHandler.php +++ b/typo3/sysext/core/Classes/Console/CommandRequestHandler.php @@ -74,8 +74,10 @@ class CommandRequestHandler implements RequestHandlerInterface $command = $this->getCommandToRun($input); if (!$command) { + // Using old "cliKeys" is marked as deprecated and will be removed in TYPO3 v9 $cliKeys = array_keys($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys']); + $output->writeln('Using old "cliKeys" ($GLOBALS[TYPO3_CONF_VARS][SC_OPTIONS][GLOBAL][cliKeys]) is marked as deprecated and will be removed in TYPO3 v9:'); $output->writeln('Old entrypoint keys available:'); asort($cliKeys); foreach ($cliKeys as $key => $value) { diff --git a/typo3/sysext/core/Configuration/DefaultConfiguration.php b/typo3/sysext/core/Configuration/DefaultConfiguration.php index eedcc0643559..037c6a4b8db1 100644 --- a/typo3/sysext/core/Configuration/DefaultConfiguration.php +++ b/typo3/sysext/core/Configuration/DefaultConfiguration.php @@ -1064,6 +1064,7 @@ return [ 'email' => \TYPO3\CMS\Core\Database\SoftReferenceIndex::class, 'url' => \TYPO3\CMS\Core\Database\SoftReferenceIndex::class, ], + // cliKeys have been deprecated and will be removed in TYPO3 v9 'cliKeys' => [] ], ], diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-80468-CommandLineInterfaceCliKeysAndCli_dispatchphpsh.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-80468-CommandLineInterfaceCliKeysAndCli_dispatchphpsh.rst new file mode 100644 index 000000000000..78452471edc4 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-80468-CommandLineInterfaceCliKeysAndCli_dispatchphpsh.rst @@ -0,0 +1,48 @@ +.. include:: ../../Includes.txt + +============================================================================ +Deprecation: #80468 - Command Line Interface: cliKeys and cli_dispatch.phpsh +============================================================================ + +See :issue:`80468` + +Description +=========== + +The functionality to register any command line script via php``$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys']['my_extension']`` has been marked as deprecated. + +The entrypoint ``typo3/cli_dispatch.phpsh`` as well as the corresponding Application class and +the CliRequestHandler class have been marked as deprecated as well. + +The functionality has been superseded by Symfony Console and the new entry-point within +``typo3/sysext/core/bin/typo3`` which is able to handle all functionality the same way including +all Extbase-related Command Controllers. + + +Impact +====== + +Calling the CLI entrypoint ``typo3/cli_dispatch.phpsh`` to call a CLI script will trigger a +deprecation warning. + + +Affected Installations +====================== + +Any installation using ``typo3/cli_dispatch.phpsh`` in any deployment or cronjob / scheduler +functionality. + + +Migration +========= + +All functionality related to Extbase, EXT:lowlevel, or scheduler tasks can be called via +the new entrypoint ``typo3/sysext/core/bin/typo3`` with a similar call. + +Update all cronjobs and automated and manual running scripts called via the command line to use +the new entrypoint. + +If there any custom cliKeys registered, migrate them to a Symfony Command or an Extbase Command +Controller. + +.. index:: CLI \ No newline at end of file diff --git a/typo3/sysext/extbase/ext_localconf.php b/typo3/sysext/extbase/ext_localconf.php index 70b69a9fe43e..048fa541126c 100644 --- a/typo3/sysext/extbase/ext_localconf.php +++ b/typo3/sysext/extbase/ext_localconf.php @@ -33,6 +33,7 @@ unset($extbaseObjectContainer); if (TYPO3_MODE === 'BE') { // registers Extbase at the cli_dispatcher with key "extbase". + // Using cliKeys is deprecated as of TYPO3 v8 and will be removed in TYPO3 v9, use Configuration/Commands.php instead $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys']['extbase'] = [ function () { $bootstrap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Core\Bootstrap::class); diff --git a/typo3/sysext/lowlevel/ext_localconf.php b/typo3/sysext/lowlevel/ext_localconf.php index 8f892b0d8beb..397b28084a36 100644 --- a/typo3/sysext/lowlevel/ext_localconf.php +++ b/typo3/sysext/lowlevel/ext_localconf.php @@ -3,6 +3,7 @@ defined('TYPO3_MODE') or die(); if (TYPO3_MODE === 'BE') { // Setting up scripts that can be run from the cli_dispatch.phpsh script. + // Using cliKeys is deprecated as of TYPO3 v8 and will be removed in TYPO3 v9, use Configuration/Commands.php instead $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys']['lowlevel_cleaner'] = [ function () { $cleanerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Lowlevel\CleanerCommand::class); diff --git a/typo3/sysext/scheduler/ext_localconf.php b/typo3/sysext/scheduler/ext_localconf.php index 50614a053d48..6f748032aaef 100644 --- a/typo3/sysext/scheduler/ext_localconf.php +++ b/typo3/sysext/scheduler/ext_localconf.php @@ -2,6 +2,7 @@ defined('TYPO3_MODE') or die(); // Register the Scheduler as a possible key for CLI calls +// Using cliKeys is deprecated as of TYPO3 v8 and will be removed in TYPO3 v9, use Configuration/Commands.php instead $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys']['scheduler'] = [ function ($input, $output) { $app = new \Symfony\Component\Console\Application('TYPO3 Scheduler', TYPO3_version); -- GitLab