Skip to content

Commit

Permalink
[TASK] Remove legacy supports for TypoScript registration
Browse files Browse the repository at this point in the history
This change:

* Removes support for using `plugin.tx_fluidpages.collections.` to define collection paths.
* Removes support for using `plugin.tx_fed.page.` to define collection paths.
* Removes a hacky patch whose functionality is now being taken care of by the ConfigurationManager implementation from Flux.
* Removes a debug message about missing template root path which can no longer occur because values are patched by Flux's services.
* Removes an L1 cache since triple merging of TS no longer takes place.

The change is only breaking if the site currently uses one of the two legacy methods for registering template collections.
  • Loading branch information
NamelessCoder committed Feb 6, 2015
1 parent 4153a5d commit b5fd17b
Showing 1 changed file with 7 additions and 59 deletions.
66 changes: 7 additions & 59 deletions Classes/Service/ConfigurationService.php
Expand Up @@ -71,10 +71,6 @@ public function getViewConfigurationByFileReference($reference) {
* @api
*/
public function getPageConfiguration($extensionName = NULL) {
$cacheKey = NULL === $extensionName ? 'pages_global' : 'pages_' . $extensionName;
if (TRUE === isset(self::$cache[$cacheKey])) {
return self::$cache[$cacheKey];
}
if (NULL !== $extensionName && TRUE === empty($extensionName)) {
// Note: a NULL extensionName means "fetch ALL defined collections" whereas
// an empty value that is not null indicates an incorrect caller. Instead
Expand All @@ -86,63 +82,15 @@ public function getPageConfiguration($extensionName = NULL) {
'be identified here) from showing up', GeneralUtility::SYSLOG_SEVERITY_NOTICE);
return array();
}
if (TYPO3_MODE === 'BE') {
// Hack. This is no fun matter, but the TYPO3 BackendConfigurationManager
// is incapable of considering how to fetch a page UID from the "editconf"
// array which is used when editing a particular page. The result is that
// because Flux uses Extbase's resolve methods for TypoScript, the methods
// will use the fallback behavior (only root TS templates). Forcibly setting
// this GET['id'] should not have a negative effect on other scripts and will
// fix the problem - because Extbase will instantly detect and use this ID.
// New behaviour has one flaw: editing multiple pages will cause every page
// to use the first page's TypoScript settings and therefore page templates -
// which could be a problem when editing multiple pages each having own TS.
if (TRUE === isset($GLOBALS['SOBE']->editconf['pages'])) {
$_GET['id'] = key($GLOBALS['SOBE']->editconf['pages']);
}
if (NULL !== $extensionName) {
return $this->getViewConfigurationForExtensionName($extensionName);
}
$newLocation = (array) $this->getTypoScriptSubConfiguration($extensionName, 'collections', 'fluidpages');
$oldLocation = (array) $this->getTypoScriptSubConfiguration($extensionName, 'page', 'fed');
$merged = RecursiveArrayUtility::mergeRecursiveOverrule($oldLocation, $newLocation);
if (NULL === $extensionName) {
$registeredExtensionKeys = Core::getRegisteredProviderExtensionKeys('Page');
foreach ($registeredExtensionKeys as $registeredExtensionKey) {
$extensionViewPaths = $this->getPageConfiguration($registeredExtensionKey);
if (FALSE === isset($extensionViewPaths['extensionKey'])) {
$extensionViewPaths['extensionKey'] = ExtensionNamingUtility::getExtensionKey($registeredExtensionKey);
}
// preemptive caching; once read here, the cached value is returned when asking for specific extensions later
if (FALSE === isset($extensionViewPaths['templateRootPath'])) {
$this->sendWarningAboutMissingTemplatePath($registeredExtensionKey);
continue;
}
self::$cache[$registeredExtensionKey] = $extensionViewPaths;
$merged[$registeredExtensionKey] = $extensionViewPaths;
}
} else {
$nativeViewLocation = $this->getViewConfigurationForExtensionName($extensionName);
if (TRUE === is_array($nativeViewLocation)) {
$merged = RecursiveArrayUtility::mergeRecursiveOverrule($nativeViewLocation, $merged);
}
if (FALSE === isset($nativeViewLocation['extensionKey'])) {
$merged['extensionKey'] = ExtensionNamingUtility::getExtensionKey($extensionName);
}
if (FALSE === isset($merged['templateRootPath'])) {
$this->sendWarningAboutMissingTemplatePath($extensionName);
}
$configurations = array();
$registeredExtensionKeys = Core::getRegisteredProviderExtensionKeys('Page');
foreach ($registeredExtensionKeys as $registeredExtensionKey) {
$configurations[$registeredExtensionKey] = $this->getViewConfigurationForExtensionName($registeredExtensionKey);
}
self::$cache[$cacheKey] = $merged;
return $merged;
}

/**
* @param string $extensionName
* @return void
*/
protected function sendWarningAboutMissingTemplatePath($extensionName) {
$this->message('The configuration for extension "' . $extensionName . '" does not contain ' .
'at least a templateRootPath. This indicates that the static TypoScript for the extension is not loaded or ' .
'it uses constants which are either not defined, cleared or set to an empty value', GeneralUtility::SYSLOG_SEVERITY_FATAL);
return $configurations;
}

}

0 comments on commit b5fd17b

Please sign in to comment.