From 2cdbc43fe7664d0796d143d7033f0a1cb98d91fe Mon Sep 17 00:00:00 2001 From: Thomas Maroschik <tmaroschik@dfau.de> Date: Mon, 21 Oct 2013 19:47:20 +0200 Subject: [PATCH] [BUGFIX] Replace the table definition manipulation by signals During installation of extensions the Extension Manager does not take the Category API into account. The code to do so is present in the Install Tool in the Database Compare Tool. It is cumbersome to switch to the install tool to update the database in order to use the category fields. The install tool and extension manager currently need to know which components manipulate the table definitions and this is bad coupling of components which shouldn't know each other. This fix replaces the individual calls to the components by two signals and thus a generic approach. Fixes: #53016 Releases: 6.2 Change-Id: I7f99ad7cadc323d4f8b975de97e4c665a82647a5 Reviewed-on: https://review.typo3.org/26506 Reviewed-by: Fabien Udriot Reviewed-by: Helmut Hummel Tested-by: Helmut Hummel --- typo3/sysext/core/Classes/Cache/Cache.php | 14 +++ .../Classes/Category/CategoryRegistry.php | 29 +++++- .../FunctionalTestCaseBootstrapUtility.php | 4 +- .../Unit/Category/CategoryRegistryTest.php | 7 -- .../Classes/Utility/InstallUtility.php | 44 ++++++--- .../Tests/Unit/Utility/InstallUtilityTest.php | 17 +--- .../sysext/extensionmanager/ext_localconf.php | 12 +++ .../Controller/Action/Tool/UpdateWizard.php | 6 +- .../CachingFrameworkDatabaseSchemaService.php | 92 +++++++++++++++++++ ...expectedSignalReturnValueTypeException.php | 32 +++++++ .../Service/SqlExpectedSchemaService.php | 69 +++++--------- typo3/sysext/install/ext_localconf.php | 14 +++ 12 files changed, 257 insertions(+), 83 deletions(-) create mode 100644 typo3/sysext/install/Classes/Service/CachingFrameworkDatabaseSchemaService.php create mode 100644 typo3/sysext/install/Classes/Service/Exception/UnexpectedSignalReturnValueTypeException.php diff --git a/typo3/sysext/core/Classes/Cache/Cache.php b/typo3/sysext/core/Classes/Cache/Cache.php index c8f314e6ce8b..694f29597a17 100644 --- a/typo3/sysext/core/Classes/Cache/Cache.php +++ b/typo3/sysext/core/Classes/Cache/Cache.php @@ -98,4 +98,18 @@ class Cache { return $tableDefinitions; } + /** + * A slot method to inject the required caching framework database tables to the + * tables definitions string + * + * @param array $sqlString + * @param string $extensionKey + * @return array + */ + public function addCachingFrameworkRequiredDatabaseSchemaToTablesDefinition(array $sqlString, $extensionKey) { + $GLOBALS['typo3CacheManager']->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']); + $sqlString[] = static::getDatabaseTableDefinitions(); + return array('sqlString' => $sqlString, 'extensionKey' => $extensionKey); + } + } diff --git a/typo3/sysext/core/Classes/Category/CategoryRegistry.php b/typo3/sysext/core/Classes/Category/CategoryRegistry.php index df23603b1d87..2ea70aeebf48 100644 --- a/typo3/sysext/core/Classes/Category/CategoryRegistry.php +++ b/typo3/sysext/core/Classes/Category/CategoryRegistry.php @@ -88,8 +88,8 @@ class CategoryRegistry implements \TYPO3\CMS\Core\SingletonInterface { throw new \InvalidArgumentException('TYPO3\\CMS\\Core\\Category\\CategoryRegistry No tableName given.', 1369122038); } - // Makes sure there is an existing table configuration and nothing registered yet: - if (isset($GLOBALS['TCA'][$tableName]) && !$this->isRegistered($tableName, $fieldName)) { + // Makes sure nothing was registered yet. + if (!$this->isRegistered($tableName, $fieldName)) { $this->registry[$extensionKey][$tableName][$fieldName] = $options; $result = TRUE; } @@ -372,4 +372,29 @@ class CategoryRegistry implements \TYPO3\CMS\Core\SingletonInterface { \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns($tableName, $columns); } } + + /** + * A slot method to inject the required category database fields to the + * tables definition string + * + * @param array $sqlString + * @return array + */ + public function addCategoryDatabaseSchemaToTablesDefinition(array $sqlString) { + $sqlString[] = $this->getDatabaseTableDefinitions(); + return array('sqlString' => $sqlString); + } + + /** + * A slot method to inject the required category database fields of an + * extension to the tables definition string + * + * @param array $sqlString + * @param string $extensionKey + * @return array + */ + public function addExtensionCategoryDatabaseSchemaToTablesDefinition(array $sqlString, $extensionKey) { + $sqlString[] = $this->getDatabaseTableDefinition($extensionKey); + return array('sqlString' => $sqlString, 'extensionKey' => $extensionKey); + } } diff --git a/typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php b/typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php index 7e63f46d4766..d75ddedfff0d 100644 --- a/typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php +++ b/typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php @@ -401,8 +401,10 @@ class FunctionalTestCaseBootstrapUtility { protected function createDatabaseStructure() { /** @var \TYPO3\CMS\Install\Service\SqlSchemaMigrationService $schemaMigrationService */ $schemaMigrationService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\Service\\SqlSchemaMigrationService'); + /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */ + $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); /** @var \TYPO3\CMS\Install\Service\SqlExpectedSchemaService $expectedSchemaService */ - $expectedSchemaService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\Service\\SqlExpectedSchemaService'); + $expectedSchemaService = $objectManager->get('TYPO3\\CMS\\Install\\Service\\SqlExpectedSchemaService'); // Raw concatenated ext_tables.sql and friends string $expectedSchemaString = $expectedSchemaService->getTablesDefinitionString(TRUE); diff --git a/typo3/sysext/core/Tests/Unit/Category/CategoryRegistryTest.php b/typo3/sysext/core/Tests/Unit/Category/CategoryRegistryTest.php index 951ca1d6f473..51dff1ef127a 100644 --- a/typo3/sysext/core/Tests/Unit/Category/CategoryRegistryTest.php +++ b/typo3/sysext/core/Tests/Unit/Category/CategoryRegistryTest.php @@ -69,13 +69,6 @@ class CategoryRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase { $this->assertTrue($this->fixture->add('test_extension_a', $this->tables['first'], 'categories')); } - /** - * @test - */ - public function doesAddReturnFalseOnUndefinedTable() { - $this->assertFalse($this->fixture->add('test_extension_a', 'undefined_table', 'categories')); - } - /** * @test * @expectedException \InvalidArgumentException diff --git a/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php b/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php index 8c31be80afcd..c808260be891 100644 --- a/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php +++ b/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php @@ -120,7 +120,7 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface { $this->loadExtension($extensionKey); } $this->reloadCaches(); - $this->processCachingFrameworkUpdates(); + $this->processRuntimeDatabaseUpdates($extensionKey); $this->saveDefaultConfiguration($extension['key']); if ($extension['clearcacheonload']) { $GLOBALS['typo3CacheManager']->flushCaches(); @@ -240,20 +240,40 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface { } /** - * Gets all registered caches and creates required caching framework tables. + * Gets all database updates due to runtime configuration, like caching framework or + * category api for example * - * @return void + * @param string $extensionKey */ - protected function processCachingFrameworkUpdates() { - $extTablesSqlContent = ''; - - // @TODO: This should probably moved to TYPO3\CMS\Core\Cache\Cache->getDatabaseTableDefinitions ?! - $GLOBALS['typo3CacheManager']->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']); - $extTablesSqlContent .= \TYPO3\CMS\Core\Cache\Cache::getDatabaseTableDefinitions(); + protected function processRuntimeDatabaseUpdates($extensionKey) { + $sqlString = $this->emitTablesDefinitionIsBeingBuiltSignal($extensionKey); + if (!empty($sqlString)) { + $this->updateDbWithExtTablesSql(implode(LF . LF . LF . LF, $sqlString)); + } + } - if ($extTablesSqlContent !== '') { - $this->updateDbWithExtTablesSql($extTablesSqlContent); + /** + * Emits a signal to manipulate the tables definitions + * + * @param string $extensionKey + * @return mixed + * @throws \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException + */ + protected function emitTablesDefinitionIsBeingBuiltSignal($extensionKey) { + $signalReturn = $this->signalSlotDispatcher->dispatch(__CLASS__, 'tablesDefinitionIsBeingBuilt', array('sqlString' => array(), 'extensionKey' => $extensionKey)); + $sqlString = $signalReturn['sqlString']; + if (!is_array($sqlString)) { + throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException( + sprintf( + 'The signal %s of class %s returned a value of type %s, but array was expected.', + 'tablesDefinitionIsBeingBuilt', + __CLASS__, + gettype($sqlString) + ), + 1382360258 + ); } + return $sqlString; } /** @@ -263,7 +283,7 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface { */ public function reloadCaches() { $GLOBALS['typo3CacheManager']->flushCachesInGroup('system'); - \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->reloadTypo3LoadedExtAndClassLoaderAndExtLocalconf(); + \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->reloadTypo3LoadedExtAndClassLoaderAndExtLocalconf()->loadExtensionTables(); } /** diff --git a/typo3/sysext/extensionmanager/Tests/Unit/Utility/InstallUtilityTest.php b/typo3/sysext/extensionmanager/Tests/Unit/Utility/InstallUtilityTest.php index 3d91d1ee3813..a0e2c95551a6 100644 --- a/typo3/sysext/extensionmanager/Tests/Unit/Utility/InstallUtilityTest.php +++ b/typo3/sysext/extensionmanager/Tests/Unit/Utility/InstallUtilityTest.php @@ -64,6 +64,7 @@ class InstallUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { 'loadExtension', 'unloadExtension', 'processDatabaseUpdates', + 'processRuntimeDatabaseUpdates', 'reloadCaches', 'processCachingFrameworkUpdates', 'saveDefaultConfiguration', @@ -120,20 +121,10 @@ class InstallUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase { /** * @test */ - public function installCallsProcessDatabaseUpdates() { + public function installCallsProcessRuntimeDatabaseUpdates() { $this->installMock->expects($this->once()) - ->method('processDatabaseUpdates') - ->with($this->extensionData); - - $this->installMock->install($this->extensionKey); - } - - /** - * @test - */ - public function installCallsProcessCachingFrameworkUpdates() { - $this->installMock->expects($this->once()) - ->method('processCachingFrameworkUpdates'); + ->method('processRuntimeDatabaseUpdates') + ->with($this->extensionKey); $this->installMock->install($this->extensionKey); } diff --git a/typo3/sysext/extensionmanager/ext_localconf.php b/typo3/sysext/extensionmanager/ext_localconf.php index f339e043940b..c2b628135b7e 100644 --- a/typo3/sysext/extensionmanager/ext_localconf.php +++ b/typo3/sysext/extensionmanager/ext_localconf.php @@ -21,5 +21,17 @@ if (TYPO3_MODE === 'BE') { 'TYPO3\\CMS\\Core\\Package\\PackageManager', 'scanAvailablePackages' ); + $signalSlotDispatcher->connect( + 'TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', + 'tablesDefinitionIsBeingBuilt', + 'TYPO3\\CMS\\Core\\Cache\\Cache', + 'addCachingFrameworkRequiredDatabaseSchemaToTablesDefinition' + ); + $signalSlotDispatcher->connect( + 'TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', + 'tablesDefinitionIsBeingBuilt', + 'TYPO3\\CMS\\Core\\Category\\CategoryRegistry', + 'addExtensionCategoryDatabaseSchemaToTablesDefinition' + ); } } diff --git a/typo3/sysext/install/Classes/Controller/Action/Tool/UpdateWizard.php b/typo3/sysext/install/Classes/Controller/Action/Tool/UpdateWizard.php index c5287a266745..94a9743f6a2e 100644 --- a/typo3/sysext/install/Classes/Controller/Action/Tool/UpdateWizard.php +++ b/typo3/sysext/install/Classes/Controller/Action/Tool/UpdateWizard.php @@ -258,9 +258,9 @@ class UpdateWizard extends Action\AbstractAction implements Action\ActionInterfa /** @var $sqlHandler \TYPO3\CMS\Install\Service\SqlSchemaMigrationService */ $sqlHandler = $this->objectManager->get('TYPO3\\CMS\\Install\\Service\\SqlSchemaMigrationService'); - /** @var \TYPO3\CMS\Install\Service\SqlExpectedSchemaService $expectedSchemaService */ - $expectedSchemaService = $this->objectManager->get('TYPO3\\CMS\\Install\\Service\\SqlExpectedSchemaService'); - $expectedSchemaString = $expectedSchemaService->getCachingFrameworkRequiredDatabaseSchema(); + /** @var \TYPO3\CMS\Install\Service\CachingFrameworkDatabaseSchemaService $cachingFrameworkDatabaseSchemaService */ + $cachingFrameworkDatabaseSchemaService = $this->objectManager->get('TYPO3\\CMS\\Install\\Service\\CachingFrameworkDatabaseSchemaService'); + $expectedSchemaString = $cachingFrameworkDatabaseSchemaService->getCachingFrameworkRequiredDatabaseSchema(); $cleanedExpectedSchemaString = implode(LF, $sqlHandler->getStatementArray($expectedSchemaString, TRUE, '^CREATE TABLE ')); $neededTableDefinition = $sqlHandler->getFieldDefinitions_fileContent($cleanedExpectedSchemaString); $currentTableDefinition = $sqlHandler->getFieldDefinitions_database(); diff --git a/typo3/sysext/install/Classes/Service/CachingFrameworkDatabaseSchemaService.php b/typo3/sysext/install/Classes/Service/CachingFrameworkDatabaseSchemaService.php new file mode 100644 index 000000000000..fe04a1d7d4aa --- /dev/null +++ b/typo3/sysext/install/Classes/Service/CachingFrameworkDatabaseSchemaService.php @@ -0,0 +1,92 @@ +<?php +namespace TYPO3\CMS\Install\Service; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Thomas Maroschik + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * A copy is found in the textfile GPL.txt and important notices to the license + * from the author is found in LICENSE.txt distributed with these scripts. + * + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * This service provides the sql schema for the caching framework + */ +class CachingFrameworkDatabaseSchemaService { + + /** + * Get schema SQL of required cache framework tables. + * + * This method needs ext_localconf and ext_tables loaded! + * + * This is a hack, but there was no smarter solution with current cache configuration setup: + * ToolController sets the extbase caches to NullBackend to ensure the install tool does not + * cache anything. The CacheManager gets the required SQL from database backends only, so we need to + * temporarily 'fake' the standard db backends for extbase caches so they are respected. + * + * Additionally, the extbase_object cache is already in use and instantiated, and the CacheManager singleton + * does not allow overriding this definition. The only option at the moment is to 'fake' another cache with + * a different name, and then substitute this name in the sql content with the real one. + * + * @TODO: http://forge.typo3.org/issues/54498 + * @TODO: It might be possible to reduce this ugly construct by circumventing the 'singleton' of CacheManager by using 'new' + * + * @return string Cache framework SQL + */ + public function getCachingFrameworkRequiredDatabaseSchema() { + $cacheConfigurationBackup = $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']; + $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_datamapfactory_datamap'] = array( + 'groups' => array('system') + ); + $extbaseObjectFakeName = uniqid('extbase_object'); + $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$extbaseObjectFakeName] = array( + 'groups' => array('system') + ); + $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_reflection'] = array( + 'groups' => array('system') + ); + $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_typo3dbbackend_tablecolumns'] = array( + 'groups' => array('system') + ); + /** @var \TYPO3\CMS\Core\Cache\CacheManager $cacheManager */ + $cacheManager = $GLOBALS['typo3CacheManager']; + $cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']); + $cacheSqlString = \TYPO3\CMS\Core\Cache\Cache::getDatabaseTableDefinitions(); + $sqlString = str_replace($extbaseObjectFakeName, 'extbase_object', $cacheSqlString); + $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'] = $cacheConfigurationBackup; + $cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']); + + return $sqlString; + } + + /** + * A slot method to inject the required caching framework database tables to the + * tables definitions string + * + * @param array $sqlString + * @return array + */ + public function addCachingFrameworkRequiredDatabaseSchemaToTablesDefinition(array $sqlString) { + $sqlString[] = $this->getCachingFrameworkRequiredDatabaseSchema(); + return array('sqlString' => $sqlString); + } + +} diff --git a/typo3/sysext/install/Classes/Service/Exception/UnexpectedSignalReturnValueTypeException.php b/typo3/sysext/install/Classes/Service/Exception/UnexpectedSignalReturnValueTypeException.php new file mode 100644 index 000000000000..b6ea00133848 --- /dev/null +++ b/typo3/sysext/install/Classes/Service/Exception/UnexpectedSignalReturnValueTypeException.php @@ -0,0 +1,32 @@ +<?php +namespace TYPO3\CMS\Install\Service\Exception; + +/*************************************************************** + * Copyright notice + * + * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch> + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * An exception thrown if the return value type of a signal is not the expected one. + */ +class UnexpectedSignalReturnValueTypeException extends CoreVersionServiceException { + +} \ No newline at end of file diff --git a/typo3/sysext/install/Classes/Service/SqlExpectedSchemaService.php b/typo3/sysext/install/Classes/Service/SqlExpectedSchemaService.php index 626ec5f7a9ce..a21354266092 100644 --- a/typo3/sysext/install/Classes/Service/SqlExpectedSchemaService.php +++ b/typo3/sysext/install/Classes/Service/SqlExpectedSchemaService.php @@ -42,6 +42,12 @@ class SqlExpectedSchemaService { */ protected $objectManager = NULL; + /** + * @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher + * @inject + */ + protected $signalSlotDispatcher; + /** * Get expected schema array * @@ -81,58 +87,31 @@ class SqlExpectedSchemaService { } } - // Add caching framework sql definition - $sqlString[] = $this->getCachingFrameworkRequiredDatabaseSchema(); - - // Add category registry sql definition - $sqlString[] = \TYPO3\CMS\Core\Category\CategoryRegistry::getInstance()->getDatabaseTableDefinitions(); + $sqlString = $this->emitTablesDefinitionIsBeingBuiltSignal($sqlString); return implode(LF . LF . LF . LF, $sqlString); } /** - * Get schema SQL of required cache framework tables. - * - * This method needs ext_localconf and ext_tables loaded! + * Emits a signal to manipulate the tables definitions * - * This is a hack, but there was no smarter solution with current cache configuration setup: - * ToolController sets the extbase caches to NullBackend to ensure the install tool does not - * cache anything. The CacheManager gets the required SQL from database backends only, so we need to - * temporarily 'fake' the standard db backends for extbase caches so they are respected. - * - * Additionally, the extbase_object cache is already in use and instantiated, and the CacheManager singleton - * does not allow overriding this definition. The only option at the moment is to 'fake' another cache with - * a different name, and then substitute this name in the sql content with the real one. - * - * @TODO: This construct needs to be improved. It does not recognise if some custom ext overwrote the extbase cache config - * @TODO: Solve this as soon as cache configuration is separated from ext_localconf / ext_tables - * @TODO: It might be possible to reduce this ugly construct by circumventing the 'singleton' of CacheManager by using 'new' - * - * @return string Cache framework SQL + * @param array $sqlString + * @return mixed */ - public function getCachingFrameworkRequiredDatabaseSchema() { - $cacheConfigurationBackup = $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']; - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_datamapfactory_datamap'] = array( - 'groups' => array('system') - ); - $extbaseObjectFakeName = uniqid('extbase_object'); - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$extbaseObjectFakeName] = array( - 'groups' => array('system') - ); - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_reflection'] = array( - 'groups' => array('system') - ); - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_typo3dbbackend_tablecolumns'] = array( - 'groups' => array('system') - ); - /** @var \TYPO3\CMS\Core\Cache\CacheManager $cacheManager */ - $cacheManager = $GLOBALS['typo3CacheManager']; - $cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']); - $cacheSqlString = \TYPO3\CMS\Core\Cache\Cache::getDatabaseTableDefinitions(); - $sqlString = str_replace($extbaseObjectFakeName, 'extbase_object', $cacheSqlString); - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'] = $cacheConfigurationBackup; - $cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']); - + protected function emitTablesDefinitionIsBeingBuiltSignal(array $sqlString) { + $signalReturn = $this->signalSlotDispatcher->dispatch(__CLASS__, 'tablesDefinitionIsBeingBuilt', array('sqlString' => $sqlString)); + $sqlString = $signalReturn['sqlString']; + if (!is_array($sqlString)) { + throw new Exception\UnexpectedSignalReturnValueTypeException( + sprintf( + 'The signal %s of class %s returned a value of type %s, but array was expected.', + 'tablesDefinitionIsBeingBuilt', + __CLASS__, + gettype($sqlString) + ), + 1382351456 + ); + } return $sqlString; } } diff --git a/typo3/sysext/install/ext_localconf.php b/typo3/sysext/install/ext_localconf.php index 06007b404227..c003ed86bebd 100644 --- a/typo3/sysext/install/ext_localconf.php +++ b/typo3/sysext/install/ext_localconf.php @@ -52,3 +52,17 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['sysext_file_ // Version 4.7: Migrate the flexforms of MediaElement $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['mediaElementFlexform'] = 'TYPO3\\CMS\\Install\\Updates\\MediaFlexformUpdate'; + +$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher'); +$signalSlotDispatcher->connect( + 'TYPO3\\CMS\\Install\\Service\\SqlExpectedSchemaService', + 'tablesDefinitionIsBeingBuilt', + 'TYPO3\\CMS\\Install\\Service\\CachingFrameworkDatabaseSchemaService', + 'addCachingFrameworkRequiredDatabaseSchemaToTablesDefinition' +); +$signalSlotDispatcher->connect( + 'TYPO3\\CMS\\Install\\Service\\SqlExpectedSchemaService', + 'tablesDefinitionIsBeingBuilt', + 'TYPO3\\CMS\\Core\\Category\\CategoryRegistry', + 'addCategoryDatabaseSchemaToTablesDefinition' +); -- GitLab