Commit fd7d3d37 authored by Oliver Hader's avatar Oliver Hader
Browse files

[TASK] Integrate external projects Fluid and Extbase as Git submodules

Change-Id: I6637620820258b3b5c78b650ee6cd94871b9892b
Resolves: #27446
Reviewed-on: http://review.typo3.org/2739
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
parent cb390c79
......@@ -7,3 +7,9 @@
[submodule "typo3/sysext/dbal"]
path = typo3/sysext/dbal
url = git://git.typo3.org/TYPO3v4/Extensions/dbal.git
[submodule "typo3/sysext/fluid"]
path = typo3/sysext/fluid
url = git://git.typo3.org/TYPO3v4/CoreProjects/MVC/fluid.git
[submodule "typo3/sysext/extbase"]
path = typo3/sysext/extbase
url = git://git.typo3.org/TYPO3v4/CoreProjects/MVC/extbase.git
extbase @ 0fbf871e
Subproject commit 0fbf871ec771148334fce73dadc5d2d9af55b4e1
This diff is collapsed.
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
* 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!
***************************************************************/
/**
* Abstract base class for a general purpose configuration manager
*
* @package Extbase
* @subpackage Configuration
* @version $ID:$
*/
abstract class Tx_Extbase_Configuration_AbstractConfigurationManager implements t3lib_Singleton {
/**
* Default backend storage PID
*/
const DEFAULT_BACKEND_STORAGE_PID = 0;
/**
* Storage of the raw TypoScript configuration
* @var array
*/
protected $configuration = array();
/**
* @var tslib_cObj
*/
protected $contentObject;
/**
* @var Tx_Extbase_Object_ObjectManagerInterface
*/
protected $objectManager;
/**
* name of the extension this Configuration Manager instance belongs to
* @var string
*/
protected $extensionName;
/**
* name of the plugin this Configuration Manager instance belongs to
* @var string
*/
protected $pluginName;
/**
* 1st level configuration cache
*
* @var array
*/
protected $configurationCache = array();
/**
* @param Tx_Extbase_Object_ManagerInterface $objectManager
* @return void
*/
public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
$this->objectManager = $objectManager;
}
/**
* @param tslib_cObj $contentObject
* @return void
*/
public function setContentObject(tslib_cObj $contentObject = NULL) {
$this->contentObject = $contentObject;
}
/**
* @return tslib_cObj
*/
public function getContentObject() {
return $this->contentObject;
}
/**
* Sets the specified raw configuration coming from the outside.
* Note that this is a low level method and only makes sense to be used by Extbase internally.
*
* @param array $configuration The new configuration
* @return void
*/
public function setConfiguration(array $configuration = array()) {
// reset 1st level cache
$this->configurationCache = array();
$this->extensionName = $configuration['extensionName'];
$this->pluginName = $configuration['pluginName'];
$this->configuration = Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($configuration);
}
/**
* Loads the Extbase Framework configuration.
*
* The Extbase framework configuration HAS TO be retrieved using this method, as they are come from different places than the normal settings.
* Framework configuration is, in contrast to normal settings, needed for the Extbase framework to operate correctly.
*
* @param string $extensionName if specified, the configuration for the given extension will be returned (plugin.tx_extensionname)
* @param string $pluginName if specified, the configuration for the given plugin will be returned (plugin.tx_extensionname_pluginname)
* @return array the Extbase framework configuration
*/
public function getConfiguration($extensionName = NULL, $pluginName = NULL) {
// 1st level cache
if ($extensionName !== NULL) {
if ($pluginName === NULL) {
throw new Tx_Extbase_Configuration_Exception('You\'ll have to specify either both, extensionName and pluginName, or neither.', 1289852422);
}
$configurationCacheKey = strtolower($extensionName . '_' . $pluginName);
} else {
$configurationCacheKey = strtolower($this->extensionName . '_' . $this->pluginName);
}
if (isset($this->configurationCache[$configurationCacheKey])) {
return $this->configurationCache[$configurationCacheKey];
}
$frameworkConfiguration = $this->getExtbaseConfiguration();
if (!isset($frameworkConfiguration['persistence']['storagePid'])) {
$frameworkConfiguration['persistence']['storagePid'] = self::DEFAULT_BACKEND_STORAGE_PID;
}
// only merge $this->configuration and override switchableControllerActions when retrieving configuration of the current plugin
if ($extensionName === NULL || ($extensionName === $this->extensionName && $pluginName === $this->pluginName)) {
$pluginConfiguration = $this->getPluginConfiguration($this->extensionName, $this->pluginName);
$pluginConfiguration = t3lib_div::array_merge_recursive_overrule($pluginConfiguration, $this->configuration);
$pluginConfiguration['controllerConfiguration'] = $this->getSwitchableControllerActions($this->extensionName, $this->pluginName);
if (isset($this->configuration['switchableControllerActions'])) {
$this->overrideSwitchableControllerActions($pluginConfiguration, $this->configuration['switchableControllerActions']);
}
} else {
$pluginConfiguration = $this->getPluginConfiguration($extensionName, $pluginName);
$pluginConfiguration['controllerConfiguration'] = $this->getSwitchableControllerActions($extensionName, $pluginName);
}
$frameworkConfiguration = t3lib_div::array_merge_recursive_overrule($frameworkConfiguration, $pluginConfiguration);
// only load context specific configuration when retrieving configuration of the current plugin
if ($extensionName === NULL || ($extensionName === $this->extensionName && $pluginName === $this->pluginName)) {
$frameworkConfiguration = $this->getContextSpecificFrameworkConfiguration($frameworkConfiguration);
}
if (!empty($frameworkConfiguration['persistence']['storagePid']) &&
is_array($frameworkConfiguration['persistence']['storagePid'])) {
/**
* We simulate the frontend to enable the use of cObjects in
* stdWrap. Than we convert the configuration to normal TypoScript
* and apply the stdWrap to the storagePid
*/
Tx_Extbase_Utility_FrontendSimulator::simulateFrontendEnvironment($this->getContentObject());
$conf = Tx_Extbase_Utility_TypoScript::convertPlainArrayToTypoScriptArray($frameworkConfiguration['persistence']);
$frameworkConfiguration['persistence']['storagePid'] = $GLOBALS['TSFE']->cObj->stdWrap($conf['storagePid'], $conf['storagePid.']);
Tx_Extbase_Utility_FrontendSimulator::resetFrontendEnvironment();
}
// 1st level cache
$this->configurationCache[$configurationCacheKey] = $frameworkConfiguration;
return $frameworkConfiguration;
}
/**
* Returns the TypoScript configuration found in config.tx_extbase
*
* @return array
*/
protected function getExtbaseConfiguration() {
$setup = $this->getTypoScriptSetup();
$extbaseConfiguration = array();
if (isset($setup['config.']['tx_extbase.'])) {
$extbaseConfiguration = Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($setup['config.']['tx_extbase.']);
}
return $extbaseConfiguration;
}
/**
* @param array $frameworkConfiguration
* @param array $overriddenSwitchableControllerActions in the format array('Controller1' => array('action1', 'action2'), 'Controller2' => ...)
* @return void
*/
protected function overrideSwitchableControllerActions(array &$frameworkConfiguration, array $switchableControllerActions) {
$overriddenSwitchableControllerActions = array();
foreach ($switchableControllerActions as $controllerName => $actions) {
if (!isset($frameworkConfiguration['controllerConfiguration'][$controllerName])) {
continue;
}
$overriddenSwitchableControllerActions[$controllerName] = array('actions' => $actions);
$nonCacheableActions = $frameworkConfiguration['controllerConfiguration'][$controllerName]['nonCacheableActions'];
if (!is_array($nonCacheableActions)) {
// There are no non-cacheable actions, thus we can directly continue
// with the next controller name.
continue;
}
$overriddenNonCacheableActions = array_intersect($nonCacheableActions, $actions);
if (!empty($overriddenNonCacheableActions)) {
$overriddenSwitchableControllerActions[$controllerName]['nonCacheableActions'] = $overriddenNonCacheableActions;
}
}
$frameworkConfiguration['controllerConfiguration'] = $overriddenSwitchableControllerActions;
}
/**
* The context specific configuration returned by this method
* will override the framework configuration which was
* obtained from TypoScript. This can be used f.e. to override the storagePid
* with the value set inside the Plugin Instance.
*
* WARNING: Make sure this method ALWAYS returns an array!
*
* @param array $frameworkConfiguration The framework configuration until now
* @return array context specific configuration which will override the configuration obtained by TypoScript
*/
abstract protected function getContextSpecificFrameworkConfiguration(array $frameworkConfiguration);
/**
* Returns TypoScript Setup array from current Environment.
*
* @return array the TypoScript setup
*/
abstract protected function getTypoScriptSetup();
/**
* Returns the TypoScript configuration found in plugin.tx_yourextension_yourplugin / module.tx_yourextension_yourmodule
* merged with the global configuration of your extension from plugin.tx_yourextension / module.tx_yourextension
*
* @param string $extensionName
* @param string $pluginName in FE mode this is the specified plugin name, in BE mode this is the full module signature
* @return array
*/
abstract protected function getPluginConfiguration($extensionName, $pluginName);
/**
* Returns the configured controller/action pairs of the specified plugin/module in the format
* array(
* 'Controller1' => array('action1', 'action2'),
* 'Controller2' => array('action3', 'action4')
* )
*
* @param string $extensionName
* @param string $pluginName in FE mode this is the specified plugin name, in BE mode this is the full module signature
* @return array
*/
abstract protected function getSwitchableControllerActions($extensionName, $pluginName);
}
?>
\ No newline at end of file
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
* 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!
***************************************************************/
/**
* A general purpose configuration manager used in backend mode.
*
* @package Extbase
* @subpackage Configuration
* @version $ID:$
*/
class Tx_Extbase_Configuration_BackendConfigurationManager extends Tx_Extbase_Configuration_AbstractConfigurationManager {
/**
* @var array
*/
protected $typoScriptSetupCache = NULL;
/**
* Returns TypoScript Setup array from current Environment.
*
* @return array the raw TypoScript setup
*/
public function getTypoScriptSetup() {
if ($this->typoScriptSetupCache === NULL) {
$template = t3lib_div::makeInstance('t3lib_TStemplate');
// do not log time-performance information
$template->tt_track = 0;
$template->init();
// Get the root line
$sysPage = t3lib_div::makeInstance('t3lib_pageSelect');
// get the rootline for the current page
$rootline = $sysPage->getRootLine($this->getCurrentPageId());
// This generates the constants/config + hierarchy info for the template.
$template->runThroughTemplates($rootline, 0);
$template->generateConfig();
$this->typoScriptSetupCache = $template->setup;
}
return $this->typoScriptSetupCache;
}
/**
* Returns the TypoScript configuration found in module.tx_yourextension_yourmodule
* merged with the global configuration of your extension from module.tx_yourextension
*
* @param string $extensionName
* @param string $pluginName in BE mode this is actually the module signature. But we're using it just like the plugin name in FE
* @return array
*/
protected function getPluginConfiguration($extensionName, $pluginName) {
$setup = $this->getTypoScriptSetup();
$pluginConfiguration = array();
if (is_array($setup['module.']['tx_' . strtolower($extensionName) . '.'])) {
$pluginConfiguration = Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($setup['module.']['tx_' . strtolower($extensionName) . '.']);
}
$pluginSignature = strtolower($extensionName . '_' . $pluginName);
if (is_array($setup['module.']['tx_' . $pluginSignature . '.'])) {
$pluginConfiguration = t3lib_div::array_merge_recursive_overrule($pluginConfiguration, Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($setup['module.']['tx_' . $pluginSignature . '.']));
}
return $pluginConfiguration;
}
/**
* Returns the configured controller/action pairs of the specified module in the format
* array(
* 'Controller1' => array('action1', 'action2'),
* 'Controller2' => array('action3', 'action4')
* )
*
* @param string $extensionName
* @param string $pluginName in BE mode this is actually the module signature. But we're using it just like the plugin name in FE
* @return array
*/
protected function getSwitchableControllerActions($extensionName, $pluginName) {
$switchableControllerActions = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['modules'][$pluginName]['controllers'];
if (!is_array($switchableControllerActions)) {
$switchableControllerActions = array();
}
return $switchableControllerActions;
}
/**
* Returns the page uid of the current page.
* If no page is selected, we'll return the uid of the first root page.
*
* @return integer current page id. If no page is selected current root page id is returned
*/
protected function getCurrentPageId() {
$pageId = (integer)t3lib_div::_GP('id');
if ($pageId > 0) {
return $pageId;
}
// get current site root
$rootPages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'pages', 'deleted=0 AND hidden=0 AND is_siteroot=1', '', '', '1');
if (count($rootPages) > 0) {
return $rootPages[0]['uid'];
}
// get root template
$rootTemplates = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('pid', 'sys_template', 'deleted=0 AND hidden=0 AND root=1', '', '', '1');
if (count($rootTemplates) > 0) {
return $rootTemplates[0]['pid'];
}
// fallback
return self::DEFAULT_BACKEND_STORAGE_PID;
}
/**
* We need to set some default request handler if the framework configuration
* could not be loaded; to make sure Extbase also works in Backend modules
* in all contexts.
*
* @return array
*/
protected function getContextSpecificFrameworkConfiguration(array $frameworkConfiguration) {
if (!isset($frameworkConfiguration['mvc']['requestHandlers'])) {
$frameworkConfiguration['mvc']['requestHandlers'] = array(
'Tx_Extbase_MVC_Web_FrontendRequestHandler' => 'Tx_Extbase_MVC_Web_FrontendRequestHandler',
'Tx_Extbase_MVC_Web_BackendRequestHandler' => 'Tx_Extbase_MVC_Web_BackendRequestHandler'
);
}
return $frameworkConfiguration;
}
}
?>
\ No newline at end of file
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
* 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!
***************************************************************/
/**
* A configuration manager following the strategy pattern (GoF315). It hides the concrete
* implementation of the configuration manager and provides an unified acccess point.
*
* Use the shutdown() method to drop the concrete implementation.
*
* @package Extbase
* @subpackage Configuration
* @version $ID:$
*/
class Tx_Extbase_Configuration_ConfigurationManager implements Tx_Extbase_Configuration_ConfigurationManagerInterface {
/**
* @var Tx_Extbase_Object_ObjectManagerInterface
*/
protected $objectManager;
/**
* @var Tx_Extbase_Configuration_AbstractConfigurationManager
**/
protected $concreteConfigurationManager;
/**
* @param Tx_Extbase_Object_ObjectManagerInterface $objectManager
* @return void
*/
public function injectObjectManager(Tx_Extbase_Object_ObjectManagerInterface $objectManager) {
$this->objectManager = $objectManager;
$this->initializeConcreteConfigurationManager();
}
/**
* @return void
*/
protected function initializeConcreteConfigurationManager() {
if (TYPO3_MODE === 'FE') {
$this->concreteConfigurationManager = $this->objectManager->get('Tx_Extbase_Configuration_FrontendConfigurationManager');
} else {
$this->concreteConfigurationManager = $this->objectManager->get('Tx_Extbase_Configuration_BackendConfigurationManager');
}
}
/**
* @param tslib_cObj $contentObject
* @return void
*/
public function setContentObject(tslib_cObj $contentObject = NULL) {
$this->concreteConfigurationManager->setContentObject($contentObject);
}
/**
* @return tslib_cObj
*/
public function getContentObject() {
return $this->concreteConfigurationManager->getContentObject();
}
/**
* Sets the specified raw configuration coming from the outside.
* Note that this is a low level method and only makes sense to be used by Extbase internally.
*
* @param array $configuration The new configuration
* @return void
*/
public function setConfiguration(array $configuration = array()) {
$this->concreteConfigurationManager->setConfiguration($configuration);
}
/**
* Returns the specified configuration.
* The actual configuration will be merged from different sources in a defined order.
*
* Note that this is a low level method and only makes sense to be used by Extbase internally.
*
* @param string $configurationType The kind of configuration to fetch - must be one of the CONFIGURATION_TYPE_* constants
* @param string $extensionName if specified, the configuration for the given extension will be returned.
* @param string $pluginName if specified, the configuration for the given plugin will be returned.
* @return array The configuration
*/
public function getConfiguration($configurationType, $extensionName = NULL, $pluginName = NULL) {
switch ($configurationType) {
case self::CONFIGURATION_TYPE_SETTINGS :
$configuration = $this->concreteConfigurationManager->getConfiguration($extensionName, $pluginName);
return $configuration['settings'];
case self::CONFIGURATION_TYPE_FRAMEWORK :
return $this->concreteConfigurationManager->getConfiguration($extensionName, $pluginName);
case self::CONFIGURATION_TYPE_FULL_TYPOSCRIPT :
return $this->concreteConfigurationManager->getTypoScriptSetup();
default :
throw new Tx_Extbase_Configuration_Exception_InvalidConfigurationTypeException('Invalid configuration type "' . $configurationType . '"', 1206031879);
}
}
}
?>
\ No newline at end of file
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
* 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!
***************************************************************/
/**
*
*
* @package Extbase
* @subpackage Configuration
* @version $ID:$
*/
interface Tx_Extbase_Configuration_ConfigurationManagerInterface extends t3lib_Singleton {
const CONFIGURATION_TYPE_FRAMEWORK = 'Framework';
const CONFIGURATION_TYPE_SETTINGS = 'Settings';
const CONFIGURATION_TYPE_FULL_TYPOSCRIPT = 'FullTypoScript';
/**
* @param tslib_cObj $contentObject