[+BUGFIX] Extbase (Persistence): Fixed a problem where the cache was cleared at every...
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Configuration / AbstractConfigurationManager.php
index adb43f1..6ec5693 100644 (file)
@@ -50,36 +50,12 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
         */
        protected $settings;
 
-       /**
-        * The configuration source instances used for loading the raw configuration
-        *
-        * @var array
-        */
-       protected $configurationSources = array();
-
        /**
         * Constructs the configuration manager
         *
-        * @param array $configurationSources An array of configuration sources
         */
-       public function __construct($configurationSources = NULL) {
+       public function __construct() {
                $this->typoScriptParser = t3lib_div::makeInstance('t3lib_TSparser');
-               if (is_array($configurationSources)) {
-                       $this->configurationSources = $configurationSources;
-               }
-       }
-
-       /**
-        * Returns an array with the settings defined for the specified extension.
-        *
-        * @param string $extensionName Name of the extension to return the settings for
-        * @return array The settings of the specified extension
-        */
-       public function getSettings($extensionName) {
-               if (empty($this->settings[$extensionName])) {
-                       $this->loadSettings($extensionName);
-               }
-               return $this->settings[$extensionName];
        }
 
        /**
@@ -104,6 +80,7 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
 
                if (isset($pluginConfiguration['settings'])) {
                        $pluginConfiguration = $this->resolveTyposcriptReference($pluginConfiguration, 'settings');
+                       if (!is_array($pluginConfiguration['settings.'])) $pluginConfiguration['settings.'] = array(); // We expect that the settings are arrays on various places
                }
                if (isset($pluginConfiguration['persistence'])) {
                        $pluginConfiguration = $this->resolveTyposcriptReference($pluginConfiguration, 'persistence');
@@ -111,11 +88,29 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
                if (isset($pluginConfiguration['view'])) {
                        $pluginConfiguration = $this->resolveTyposcriptReference($pluginConfiguration, 'view');
                }
+               if (isset($pluginConfiguration['_LOCAL_LANG'])) {
+                       $pluginConfiguration = $this->resolveTyposcriptReference($pluginConfiguration, '_LOCAL_LANG');
+               }
+
                $frameworkConfiguration = t3lib_div::array_merge_recursive_overrule($frameworkConfiguration, Tx_Extbase_Utility_TypoScript::convertTypoScriptArrayToPlainArray($pluginConfiguration));
 
+               $frameworkConfiguration = $this->getContextSpecificFrameworkConfiguration($frameworkConfiguration);
                return $frameworkConfiguration;
        }
 
+       /**
+        * 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($frameworkConfiguration);
+
        /**
         * Returns TypoScript Setup array from current Environment.
         *
@@ -143,26 +138,5 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager {
                }
                return $pluginConfiguration;
        }
-
-       /**
-        * Loads the settings defined in the specified extensions and merges them with
-        * those potentially existing in the global configuration folders.
-        *
-        * The result is stored in the configuration manager's settings registry
-        * and can be retrieved with the getSettings() method.
-        *
-        * @param string $extensionName
-        * @return void
-        * @see getSettings()
-        */
-       protected function loadSettings($extensionName) {
-               $settings = array();
-               foreach ($this->configurationSources as $configurationSource) {
-                       $settings = t3lib_div::array_merge_recursive_overrule($settings, $configurationSource->load($extensionName));
-               }
-               $this->settings[$extensionName] = $settings;
-       }
-
-
 }
-?>
+?>
\ No newline at end of file