From 4a0502ee29b8d8d83d8cc0200812422a7baeb5cd Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Tue, 26 May 2020 16:31:51 +0200 Subject: [PATCH] [!!!][TASK] Remove deprecated constants and runtime activated packages This change removes the unneeded public constants - FILE_DENY_PATTERN_DEFAULT - PHP_EXTENSIONS_DEFAULT - TYPO3_copyright_year - TYPO3_URL_DONATE - TYPO3_URL_EXCEPTION - TYPO3_URL_GENERAL - TYPO3_URL_LICENSE - TYPO3_URL_WIKI_OPCODECACHE as well as the runtimeActivatedPackages feature, all of which have been marked as deprecated in TYPO3 v10. Resolves: #91477 Related: #91473 Releases: master Change-Id: I8e98509e2842d7fb116f44c31d4c10957b73a2ca Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64584 Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: Wouter Wolters <typo3@wouterwolters.nl> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by: Benni Mack <benni@typo3.org> --- typo3/sysext/core/Classes/Core/Bootstrap.php | 18 -------- .../Classes/Core/SystemEnvironmentBuilder.php | 41 ----------------- .../core/Classes/Package/PackageManager.php | 44 ++----------------- ...g-91473-DeprecatedFunctionalityRemoved.rst | 11 +++++ .../Package/RuntimeActivatedPackagesTest.php | 41 ----------------- .../Core/SystemEnvironmentBuilderTest.php | 29 ------------ .../ExtensionScanner/Php/ConstantMatcher.php | 24 ++++++---- 7 files changed, 30 insertions(+), 178 deletions(-) delete mode 100644 typo3/sysext/core/Tests/Functional/Package/RuntimeActivatedPackagesTest.php diff --git a/typo3/sysext/core/Classes/Core/Bootstrap.php b/typo3/sysext/core/Classes/Core/Bootstrap.php index 92f335e360ef..0370c93cbac2 100644 --- a/typo3/sysext/core/Classes/Core/Bootstrap.php +++ b/typo3/sysext/core/Classes/Core/Bootstrap.php @@ -111,7 +111,6 @@ class Bootstrap // singleton instance is required by PackageManager->activePackageDuringRuntime GeneralUtility::setSingletonInstance(PackageManager::class, $packageManager); ExtensionManagementUtility::setPackageManager($packageManager); - static::initializeRuntimeActivatedPackagesFromConfiguration($packageManager); static::setDefaultTimezone(); static::setMemoryLimit(); @@ -250,23 +249,6 @@ class Bootstrap return $packageManager; } - /** - * Activates a package during runtime. This is used in AdditionalConfiguration.php - * to enable extensions under conditions. - * - * @param PackageManager $packageManager - */ - protected static function initializeRuntimeActivatedPackagesFromConfiguration(PackageManager $packageManager) - { - $packages = $GLOBALS['TYPO3_CONF_VARS']['EXT']['runtimeActivatedPackages'] ?? []; - if (!empty($packages)) { - trigger_error('Support for runtime activated packages will be removed in TYPO3 v11.0.', E_USER_DEPRECATED); - foreach ($packages as $runtimeAddedPackageKey) { - $packageManager->activatePackageDuringRuntime($runtimeAddedPackageKey); - } - } - } - /** * Load ext_localconf of extensions * diff --git a/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php b/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php index d4a48c49e92f..4862b7e536ff 100644 --- a/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php +++ b/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php @@ -15,7 +15,6 @@ namespace TYPO3\CMS\Core\Core; -use TYPO3\CMS\Core\Resource\Security\FileNameValidator; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\PathUtility; @@ -92,13 +91,6 @@ class SystemEnvironmentBuilder */ protected static function defineBaseConstants() { - // Check one of the constants and return early if already defined, - // needed if multiple requests are handled in one process, for instance in functional testing. - // This check can be removed in TYPO3 v11.0. - if (defined('FILE_DENY_PATTERN_DEFAULT')) { - return; - } - // A linefeed, a carriage return, a CR-LF combination defined('LF') ?: define('LF', chr(10)); defined('CR') ?: define('CR', chr(13)); @@ -108,39 +100,6 @@ class SystemEnvironmentBuilder if (!defined('TYPO3_mainDir')) { define('TYPO3_mainDir', 'typo3/'); } - - /** - * @deprecated use FileNameAccess class to retrieve this information, will be removed in TYPO3 v11.0 - */ - define('FILE_DENY_PATTERN_DEFAULT', FileNameValidator::DEFAULT_FILE_DENY_PATTERN); - /** - * @deprecated use FILE_DENY_PATTERN and FileNameAccess class to retrieve this information, will be removed in TYPO3 v11.0 - */ - define('PHP_EXTENSIONS_DEFAULT', 'php,php3,php4,php5,php6,php7,php8,phpsh,inc,phtml,pht,phar'); - /** - * @deprecated use Typo3Information class to retrieve this information, will be removed in TYPO3 v11.0 - */ - define('TYPO3_copyright_year', '1998-' . date('Y')); - /** - * @deprecated use Typo3Information class to retrieve this information, will be removed in TYPO3 v11.0 - */ - define('TYPO3_URL_GENERAL', 'https://typo3.org/'); - /** - * @deprecated use Typo3Information class to retrieve this information, will be removed in TYPO3 v11.0 - */ - define('TYPO3_URL_LICENSE', 'https://typo3.org/typo3-cms/overview/licenses/'); - /** - * @deprecated use Typo3Information class to retrieve this information, will be removed in TYPO3 v11.0 - */ - define('TYPO3_URL_EXCEPTION', 'https://typo3.org/go/exception/CMS/'); - /** - * @deprecated use Typo3Information class to retrieve this information, will be removed in TYPO3 v11.0 - */ - define('TYPO3_URL_DONATE', 'https://typo3.org/community/contribute/donate/'); - /** - * @deprecated use Typo3Information class to retrieve this information, will be removed in TYPO3 v11.0 - */ - define('TYPO3_URL_WIKI_OPCODECACHE', 'https://wiki.typo3.org/Opcode_Cache'); } /** diff --git a/typo3/sysext/core/Classes/Package/PackageManager.php b/typo3/sysext/core/Classes/Package/PackageManager.php index 6934849f1c9c..8643aad3fd4a 100644 --- a/typo3/sysext/core/Classes/Package/PackageManager.php +++ b/typo3/sysext/core/Classes/Package/PackageManager.php @@ -70,11 +70,6 @@ class PackageManager implements SingletonInterface */ protected $packageAliasMap = []; - /** - * @var array - */ - protected $runtimeActivatedPackages = []; - /** * Absolute path leading to the various package directories * @var string @@ -315,26 +310,6 @@ class PackageManager implements SingletonInterface $this->scanAvailablePackages(); } - /** - * Scans all directories for a certain package. - * - * @param string $packageKey - * @return PackageInterface - * @deprecated will be removed in TYPO3 v11.0 - */ - protected function registerPackageDuringRuntime($packageKey) - { - $packagePaths = $this->scanPackagePathsForExtensions(); - $packagePath = $packagePaths[$packageKey]; - $composerManifest = $this->getComposerManifest($packagePath); - $packageKey = $this->getPackageKeyFromManifest($composerManifest, $packagePath); - $this->composerNameToPackageKeyMap[strtolower($composerManifest->name)] = $packageKey; - $packagePath = PathUtility::sanitizeTrailingSeparator($packagePath); - $package = new Package($this, $packageKey, $packagePath); - $this->registerPackage($package); - return $package; - } - /** * Fetches all directories from sysext/global/local locations and checks if the extension contains an ext_emconf.php * @@ -520,7 +495,7 @@ class PackageManager implements SingletonInterface { $packageKey = $this->getPackageKeyFromComposerName($packageKey); - return isset($this->runtimeActivatedPackages[$packageKey]) || isset($this->packageStatesConfiguration['packages'][$packageKey]); + return isset($this->packageStatesConfiguration['packages'][$packageKey]); } /** @@ -576,19 +551,6 @@ class PackageManager implements SingletonInterface $this->sortAndSavePackageStates(); } - /** - * Enables packages during runtime, but no class aliases will be available - * - * @param string $packageKey - * @deprecated will be removed in TYPO3 v11.0 - */ - public function activatePackageDuringRuntime($packageKey) - { - $package = $this->registerPackageDuringRuntime($packageKey); - $this->runtimeActivatedPackages[$package->getPackageKey()] = $package; - $this->registerTransientClassLoadingInformationForPackage($package); - } - /** * @param PackageInterface $package * @throws \TYPO3\CMS\Core\Exception @@ -638,7 +600,7 @@ class PackageManager implements SingletonInterface /** * Returns an array of \TYPO3\CMS\Core\Package objects of all active packages. * A package is active, if it is available and has been activated in the package - * manager settings. This method returns runtime activated packages too + * manager settings. * * @return PackageInterface[] */ @@ -651,7 +613,7 @@ class PackageManager implements SingletonInterface } } } - return array_merge($this->activePackages, $this->runtimeActivatedPackages); + return $this->activePackages; } /** diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-91473-DeprecatedFunctionalityRemoved.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-91473-DeprecatedFunctionalityRemoved.rst index b0c1750cf900..3f15acbdca6e 100644 --- a/typo3/sysext/core/Documentation/Changelog/master/Breaking-91473-DeprecatedFunctionalityRemoved.rst +++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-91473-DeprecatedFunctionalityRemoved.rst @@ -47,6 +47,15 @@ The following TypoScript options have been dropped: The following constants have been dropped: +- :php:`FILE_DENY_PATTERN_DEFAULT` +- :php:`PHP_EXTENSIONS_DEFAULT` +- :php:`TYPO3_copyright_year` +- :php:`TYPO3_URL_DONATE` +- :php:`TYPO3_URL_EXCEPTION` +- :php:`TYPO3_URL_GENERAL` +- :php:`TYPO3_URL_LICENSE` +- :php:`TYPO3_URL_WIKI_OPCODECACHE` + The following class constants have been dropped: - :php:`\TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider::SIGNAL_PostProcessTreeData` @@ -91,6 +100,8 @@ The following class constants have been set to protected: The following global options are ignored: +- :php:`$GLOBALS['TYPO3_CONF_VARS']['EXT']['runtimeActivatedPackages']` + The following language files and aliases have been removed: The following global variables have been removed: diff --git a/typo3/sysext/core/Tests/Functional/Package/RuntimeActivatedPackagesTest.php b/typo3/sysext/core/Tests/Functional/Package/RuntimeActivatedPackagesTest.php deleted file mode 100644 index 97d782919d5d..000000000000 --- a/typo3/sysext/core/Tests/Functional/Package/RuntimeActivatedPackagesTest.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ - -namespace TYPO3\CMS\Core\Tests\Functional\Package; - -use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; -use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; - -/** - * Test case - */ -class RuntimeActivatedPackagesTest extends FunctionalTestCase -{ - protected $configurationToUseInTestInstance = [ - 'EXT' => [ - 'runtimeActivatedPackages' => [ - 'felogin' - ] - ] - ]; - - /** - * @test - */ - public function runtimeActivatedPackageIsLoaded() - { - self::assertTrue(ExtensionManagementUtility::isLoaded('felogin')); - } -} diff --git a/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php b/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php index e5c1d8d60a4e..58a0d6a9db3a 100644 --- a/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php +++ b/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php @@ -38,35 +38,6 @@ class SystemEnvironmentBuilderTest extends UnitTestCase $this->subject = $this->getAccessibleMock(SystemEnvironmentBuilder::class, ['dummy']); } - /** - * Data provider for 'fileDenyPatternMatchesPhpExtension' test case. - * - * @return array - */ - public function fileDenyPatternMatchesPhpExtensionDataProvider() - { - $fileName = StringUtility::getUniqueId('filename'); - $data = []; - $phpExtensions = ['php', 'php3', 'php4', 'php5', 'php7', 'phpsh', 'phtml', 'pht']; - foreach ($phpExtensions as $extension) { - $data[] = [$fileName . '.' . $extension]; - $data[] = [$fileName . '.' . $extension . '.txt']; - } - return $data; - } - - /** - * Tests whether an accordant PHP extension is denied. - * - * @test - * @dataProvider fileDenyPatternMatchesPhpExtensionDataProvider - * @param string $phpExtension - */ - public function fileDenyPatternMatchesPhpExtension($phpExtension) - { - self::assertGreaterThan(0, preg_match('/' . FILE_DENY_PATTERN_DEFAULT . '/', $phpExtension), $phpExtension); - } - /** * @test */ diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstantMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstantMatcher.php index d48d251c050a..f580df103d44 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstantMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstantMatcher.php @@ -193,42 +193,50 @@ return [ ], 'TYPO3_copyright_year' => [ 'restFiles' => [ - 'Deprecation-89866-Global-TYPO3-information-related-constants.rst' + 'Deprecation-89866-Global-TYPO3-information-related-constants.rst', + 'Breaking-91473-DeprecatedFunctionalityRemoved.rst' ] ], 'TYPO3_URL_GENERAL' => [ 'restFiles' => [ - 'Deprecation-89866-Global-TYPO3-information-related-constants.rst' + 'Deprecation-89866-Global-TYPO3-information-related-constants.rst', + 'Breaking-91473-DeprecatedFunctionalityRemoved.rst' ] ], 'TYPO3_URL_LICENSE' => [ 'restFiles' => [ - 'Deprecation-89866-Global-TYPO3-information-related-constants.rst' + 'Deprecation-89866-Global-TYPO3-information-related-constants.rst', + 'Breaking-91473-DeprecatedFunctionalityRemoved.rst' ] ], 'TYPO3_URL_EXCEPTION' => [ 'restFiles' => [ - 'Deprecation-89866-Global-TYPO3-information-related-constants.rst' + 'Deprecation-89866-Global-TYPO3-information-related-constants.rst', + 'Breaking-91473-DeprecatedFunctionalityRemoved.rst' ] ], 'TYPO3_URL_DONATE' => [ 'restFiles' => [ - 'Deprecation-89866-Global-TYPO3-information-related-constants.rst' + 'Deprecation-89866-Global-TYPO3-information-related-constants.rst', + 'Breaking-91473-DeprecatedFunctionalityRemoved.rst' ] ], 'TYPO3_URL_WIKI_OPCODECACHE' => [ 'restFiles' => [ - 'Deprecation-89866-Global-TYPO3-information-related-constants.rst' + 'Deprecation-89866-Global-TYPO3-information-related-constants.rst', + 'Breaking-91473-DeprecatedFunctionalityRemoved.rst' ] ], 'FILE_DENY_PATTERN_DEFAULT' => [ 'restFiles' => [ - 'Deprecation-90147-UnifiedFileNameValidator.rst' + 'Deprecation-90147-UnifiedFileNameValidator.rst', + 'Breaking-91473-DeprecatedFunctionalityRemoved.rst' ] ], 'PHP_EXTENSIONS_DEFAULT' => [ 'restFiles' => [ - 'Deprecation-90147-UnifiedFileNameValidator.rst' + 'Deprecation-90147-UnifiedFileNameValidator.rst', + 'Breaking-91473-DeprecatedFunctionalityRemoved.rst' ] ], ]; -- GitLab