[!!!][TASK] Remove EXT/extConf configuration handling 82/59482/4
authorChristian Kuhn <lolli@schwarzbu.ch>
Fri, 18 Jan 2019 12:43:13 +0000 (13:43 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 18 Jan 2019 20:14:07 +0000 (21:14 +0100)
Resolves: #87482
Releases: master
Change-Id: Id644857a9090ab98efaa4a6bf36ee2ec37e169b0
Reviewed-on: https://review.typo3.org/59482
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/core/Classes/Configuration/ConfigurationManager.php
typo3/sysext/core/Classes/Configuration/ExtensionConfiguration.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst
typo3/sysext/core/Tests/Unit/Configuration/ExtensionConfigurationTest.php
typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php
typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php

index 72937c3..703a19a 100644 (file)
@@ -74,7 +74,6 @@ class ConfigurationManager
      * @var array
      */
     protected $whiteListedLocalConfigurationPaths = [
-        'EXT/extConf',
         'EXTCONF',
         'DB',
         'SYS/caching/cacheConfigurations',
index 924d9e2..34750ee 100644 (file)
@@ -213,17 +213,6 @@ class ExtensionConfiguration
             $configurationManager->setLocalConfigurationValueByPath('EXTENSIONS/' . $extension, $value);
             $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'][$extension] = $value;
         }
-
-        // After TYPO3_CONF_VARS['EXTENSIONS'] has been written, update legacy layer TYPO3_CONF_VARS['EXTENSIONS']['extConf']
-        // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0 with removal of old serialized 'extConf' layer
-        if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'])) {
-            $extConfArray = [];
-            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'] as $extensionName => $extensionConfig) {
-                $extConfArray[$extensionName] = serialize($this->addDotsToArrayKeysRecursiveForLegacyExtConf($extensionConfig));
-            }
-            $configurationManager->setLocalConfigurationValueByPath('EXT/extConf', $extConfArray);
-            $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'] = $extConfArray;
-        }
     }
 
     /**
@@ -239,15 +228,6 @@ class ExtensionConfiguration
         $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
         $configurationManager->setLocalConfigurationValueByPath('EXTENSIONS', $configuration);
         $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'] = $configuration;
-
-        // After TYPO3_CONF_VARS['EXTENSIONS'] has been written, update legacy layer TYPO3_CONF_VARS['EXTENSIONS']['extConf']
-        // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0 with removal of old serialized 'extConf' layer
-        $extConfArray = [];
-        foreach ($configuration as $extensionName => $extensionConfig) {
-            $extConfArray[$extensionName] = serialize($this->addDotsToArrayKeysRecursiveForLegacyExtConf($extensionConfig));
-        }
-        $configurationManager->setLocalConfigurationValueByPath('EXT/extConf', $extConfArray);
-        $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'] = $extConfArray;
     }
 
     /**
@@ -307,45 +287,6 @@ class ExtensionConfiguration
     }
 
     /**
-     * The old EXT/extConf layer had '.' (dots) at the end of all nested array keys. This is created here
-     * to keep EXT/extConf format compatible with old not yet adapted extensions.
-     * But extensions may rely on ending dots if using legacy unserialize() on their extensions, too.
-     *
-     * A EXTENSIONS array like:
-     * TYPO3_CONF_VARS['EXTENSIONS']['someExtension'] => [
-     *      'someKey' => [
-     *          'someSubKey' => [
-     *              'someSubSubKey' => 'someValue',
-     *          ],
-     *      ],
-     * ]
-     * becomes (serialized) in old EXT/extConf (mind the dots and end of array keys for sub arrays):
-     * TYPO3_CONF_VARS['EXTENSIONS']['someExtension'] => [
-     *      'someKey.' => [
-     *          'someSubKey.' => [
-     *              'someSubSubKey' => 'someValue',
-     *          ],
-     *      ],
-     * ]
-     *
-     * @param array $extensionConfig
-     * @return array
-     * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0 with removal of old serialized 'extConf' layer
-     */
-    private function addDotsToArrayKeysRecursiveForLegacyExtConf(array $extensionConfig): array
-    {
-        $newArray = [];
-        foreach ($extensionConfig as $key => $value) {
-            if (is_array($value)) {
-                $newArray[$key . '.'] = $this->addDotsToArrayKeysRecursiveForLegacyExtConf($value);
-            } else {
-                $newArray[$key] = $value;
-            }
-        }
-        return $newArray;
-    }
-
-    /**
      * Helper method of ext_conf_template.txt parsing.
      *
      * Poor man version of getDefaultConfigurationFromExtConfTemplateAsValuedArray() which ignores
index 2fce9e5..7b151d0 100644 (file)
@@ -1279,6 +1279,7 @@ The following constants have been set to protected:
 
 The following global options are ignored:
 
+* :php:`$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']`
 * :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/saltedpasswords']['saltMethods']`
 * :php:`$GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog']`
 
index 6086426..6b22acf 100644 (file)
@@ -101,64 +101,4 @@ class ExtensionConfigurationTest extends UnitTestCase
         $configurationManagerProphecy->setLocalConfigurationValueByPath('EXTENSIONS/foo', ['bar' => 'baz'])->shouldBeCalled();
         (new ExtensionConfiguration())->set('foo', '', ['bar' => 'baz']);
     }
-
-    /**
-     * @test
-     */
-    public function setUpdatesLegacyExtConfToNewValues()
-    {
-        $configurationManagerProphecy = $this->prophesize(ConfigurationManager::class);
-        GeneralUtility::addInstance(ConfigurationManager::class, $configurationManagerProphecy->reveal());
-        $configurationManagerProphecy->setLocalConfigurationValueByPath(Argument::cetera())->shouldBeCalled();
-        $configurationManagerProphecy->setLocalConfigurationValueByPath('EXT/extConf', ['foo' => serialize(['bar' => 'baz'])])->shouldBeCalled();
-        (new ExtensionConfiguration())->set('foo', '', ['bar' => 'baz']);
-    }
-
-    /**
-     * @test
-     */
-    public function setUpdatesLegacyExtConfWithDottedArrayKeysForNestedConfiguration()
-    {
-        $configurationManagerProphecy = $this->prophesize(ConfigurationManager::class);
-        GeneralUtility::addInstance(ConfigurationManager::class, $configurationManagerProphecy->reveal());
-        $nestedInput = [
-            'TopLevelKey' => [
-                'subLevelKey' => true,
-            ]
-        ];
-        $expectedLegacyExtConf = [
-            'TopLevelKey.' => [
-                'subLevelKey' => true,
-            ]
-        ];
-        $configurationManagerProphecy->setLocalConfigurationValueByPath(Argument::cetera())->shouldBeCalled();
-        $configurationManagerProphecy->setLocalConfigurationValueByPath('EXT/extConf', ['someExtension' => serialize($expectedLegacyExtConf)])->shouldBeCalled();
-        (new ExtensionConfiguration())->set('someExtension', '', $nestedInput);
-    }
-
-    /**
-     * @test
-     */
-    public function setUpdatesLegacyExtConfWithDottedArrayKeysForNestedConfigurationWithMultiNestedArrays()
-    {
-        $configurationManagerProphecy = $this->prophesize(ConfigurationManager::class);
-        GeneralUtility::addInstance(ConfigurationManager::class, $configurationManagerProphecy->reveal());
-        $nestedInput = [
-            'aCategory' => [
-                'aSubCategory' => [
-                    'aKey' => 'aValue',
-                ],
-            ],
-        ];
-        $expectedLegacyExtConf = [
-            'aCategory.' => [
-                'aSubCategory.' => [
-                    'aKey' => 'aValue',
-                ],
-            ],
-        ];
-        $configurationManagerProphecy->setLocalConfigurationValueByPath(Argument::cetera())->shouldBeCalled();
-        $configurationManagerProphecy->setLocalConfigurationValueByPath('EXT/extConf', ['someExtension' => serialize($expectedLegacyExtConf)])->shouldBeCalled();
-        (new ExtensionConfiguration())->set('someExtension', '', $nestedInput);
-    }
 }
index 6bc216a..a35e6c0 100644 (file)
@@ -136,6 +136,8 @@ class SilentConfigurationUpgradeService
         'SYS/isInitialDatabaseImportDone',
         // #84810
         'BE/explicitConfirmationOfTranslation',
+        // #87482
+        'EXT/extConf'
     ];
 
     public function __construct(ConfigurationManager $configurationManager = null)
@@ -996,16 +998,8 @@ class SilentConfigurationUpgradeService
         } catch (MissingArrayPathException $e) {
             $extensionConfiguration = [];
         }
-        try {
-            // The silent upgrade may be executed before LayoutController synchronized old serialized extConf
-            // settings to EXTENSIONS if upgrading from v8 to v9.
-            $extConfConfiguration = (string)$confManager->getLocalConfigurationValueByPath('EXT/extConf/saltedpasswords');
-            $configsToRemove[] = 'EXT/extConf/saltedpasswords';
-        } catch (MissingArrayPathException $e) {
-            $extConfConfiguration = [];
-        }
         // Migration already done
-        if (empty($extensionConfiguration) && empty($extConfConfiguration)) {
+        if (empty($extensionConfiguration)) {
             return;
         }
         // Upgrade to best available hash method. This is only done once since that code will no longer be reached
index 1b1b024..9a31645 100644 (file)
@@ -112,6 +112,7 @@ return [
     '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\']' => [
         'restFiles' => [
             'Deprecation-82254-DeprecateGLOBALSTYPO3_CONF_VARSEXTextConf.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'allowSystemInstall\']' => [
index 5504485..2311d0a 100644 (file)
@@ -864,8 +864,6 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase
         $configurationManagerException = new MissingArrayPathException('Path does not exist in array', 1533989414);
         $configurationManagerProphecy->getLocalConfigurationValueByPath('EXTENSIONS/saltedpasswords')
             ->shouldBeCalled()->willThrow($configurationManagerException);
-        $configurationManagerProphecy->getLocalConfigurationValueByPath('EXT/extConf/saltedpasswords')
-            ->shouldBeCalled()->willThrow($configurationManagerException);
         $configurationManagerProphecy->setLocalConfigurationValuesByPathValuePairs(Argument::cetera())
             ->shouldNotBeCalled();
         $silentConfigurationUpgradeService = $this->getAccessibleMock(
@@ -884,8 +882,6 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase
         $configurationManagerProphecy = $this->prophesize(ConfigurationManager::class);
         $configurationManagerProphecy->getLocalConfigurationValueByPath('EXTENSIONS/saltedpasswords')
             ->shouldBeCalled()->willReturn([]);
-        $configurationManagerProphecy->getLocalConfigurationValueByPath('EXT/extConf/saltedpasswords')
-            ->shouldBeCalled()->willReturn('');
         $configurationManagerProphecy->setLocalConfigurationValuesByPathValuePairs(Argument::cetera())
             ->shouldNotBeCalled();
         $silentConfigurationUpgradeService = $this->getAccessibleMock(
@@ -905,8 +901,6 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase
         $configurationManagerException = new MissingArrayPathException('Path does not exist in array', 1533989428);
         $configurationManagerProphecy->getLocalConfigurationValueByPath('EXTENSIONS/saltedpasswords')
             ->shouldBeCalled()->willReturn(['thereIs' => 'something']);
-        $configurationManagerProphecy->getLocalConfigurationValueByPath('EXT/extConf/saltedpasswords')
-            ->shouldBeCalled()->willThrow($configurationManagerException);
         $argonBeProphecy = $this->prophesize(Argon2iPasswordHash::class);
         $argonBeProphecy->isAvailable()->shouldBeCalled()->willReturn(true);
         GeneralUtility::addInstance(Argon2iPasswordHash::class, $argonBeProphecy->reveal());
@@ -928,42 +922,11 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase
     /**
      * @test
      */
-    public function migrateSaltedPasswordsSettingsRemovesExtConfAndSetsNothingElseIfArgon2iIsAvailable()
-    {
-        $configurationManagerProphecy = $this->prophesize(ConfigurationManager::class);
-        $configurationManagerException = new MissingArrayPathException('Path does not exist in array', 1533989434);
-        $configurationManagerProphecy->getLocalConfigurationValueByPath('EXTENSIONS/saltedpasswords')
-            ->shouldBeCalled()->willThrow($configurationManagerException);
-        $configurationManagerProphecy->getLocalConfigurationValueByPath('EXT/extConf/saltedpasswords')
-            ->shouldBeCalled()->willReturn('someConfiguration');
-        $argonBeProphecy = $this->prophesize(Argon2iPasswordHash::class);
-        $argonBeProphecy->isAvailable()->shouldBeCalled()->willReturn(true);
-        GeneralUtility::addInstance(Argon2iPasswordHash::class, $argonBeProphecy->reveal());
-        $argonFeProphecy = $this->prophesize(Argon2iPasswordHash::class);
-        $argonFeProphecy->isAvailable()->shouldBeCalled()->willReturn(true);
-        GeneralUtility::addInstance(Argon2iPasswordHash::class, $argonFeProphecy->reveal());
-        $configurationManagerProphecy->removeLocalConfigurationKeysByPath(['EXT/extConf/saltedpasswords'])
-            ->shouldBeCalled();
-        $silentConfigurationUpgradeService = $this->getAccessibleMock(
-            SilentConfigurationUpgradeService::class,
-            ['dummy'],
-            [$configurationManagerProphecy->reveal()]
-        );
-        $this->expectException(ConfigurationChangedException::class);
-        $this->expectExceptionCode(1379024938);
-        $silentConfigurationUpgradeService->_call('migrateSaltedPasswordsSettings');
-    }
-
-    /**
-     * @test
-     */
     public function migrateSaltedPasswordsSetsSpecificHashMethodIfArgon2iIsNotAvailable()
     {
         $configurationManagerProphecy = $this->prophesize(ConfigurationManager::class);
         $configurationManagerProphecy->getLocalConfigurationValueByPath('EXTENSIONS/saltedpasswords')
             ->shouldBeCalled()->willReturn(['thereIs' => 'something']);
-        $configurationManagerProphecy->getLocalConfigurationValueByPath('EXT/extConf/saltedpasswords')
-            ->shouldBeCalled()->willReturn('someConfiguration');
         $argonBeProphecy = $this->prophesize(Argon2iPasswordHash::class);
         $argonBeProphecy->isAvailable()->shouldBeCalled()->willReturn(false);
         GeneralUtility::addInstance(Argon2iPasswordHash::class, $argonBeProphecy->reveal());
@@ -980,7 +943,7 @@ class SilentConfigurationUpgradeServiceTest extends UnitTestCase
             'BE/passwordHashing/className' => BcryptPasswordHash::class,
             'FE/passwordHashing/className' => BcryptPasswordHash::class,
         ])->shouldBeCalled();
-        $configurationManagerProphecy->removeLocalConfigurationKeysByPath(['EXTENSIONS/saltedpasswords', 'EXT/extConf/saltedpasswords'])
+        $configurationManagerProphecy->removeLocalConfigurationKeysByPath(['EXTENSIONS/saltedpasswords'])
             ->shouldBeCalled();
         $silentConfigurationUpgradeService = $this->getAccessibleMock(
             SilentConfigurationUpgradeService::class,