<?php
namespace TYPO3\CMS\Install\Service;
-/***************************************************************
- * Copyright notice
- *
- * (c) 2011-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.
- * A copy is found in the text file GPL.txt and important notices to the license
- * from the author is found in LICENSE.txt distributed with these scripts.
+/**
+ * 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.
*
- * 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.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
*
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
+ * The TYPO3 project - inspiring people to share!
+ */
use TYPO3\CMS\Core\Utility\GeneralUtility;
*/
protected $objectManager = NULL;
+ /**
+ * @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
+ * @inject
+ */
+ protected $signalSlotDispatcher;
+
/**
* Get expected schema array
*
}
}
- // 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!
- *
- * 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.
+ * Emits a signal to manipulate the tables definitions
*
- * 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();
- $extbaseObjectFakeName = uniqid('extbase_object');
- $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$extbaseObjectFakeName] = array();
- $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_reflection'] = array();
- $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_typo3dbbackend_tablecolumns'] = array();
- /** @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 = $signalReturn[0];
+ 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;
}
}