From 5400ad4c5e92321b81eba44d98d0dc85345a08af Mon Sep 17 00:00:00 2001 From: Bjoern Pedersen <bjoern.pedersen@frm2.tum.de> Date: Fri, 15 Jul 2011 14:14:15 +0200 Subject: [PATCH] [BUGFIX] t3libExtMgm does not cache extension version The t3lib_extMgm::getExtensionVersion function includes the ext_emconf.php file of an extension each time it is called. The version is cached using the CF runtime cache. Change-Id: I05502a035a597b5b2b09e60d4027db47d8e2ac71 Resolves: #28233 Releases: 4.6 Reviewed-on: http://review.typo3.org/3353 Reviewed-by: Georg Ringer Reviewed-by: Philipp Gampe Tested-by: Philipp Gampe Reviewed-by: Stefan Neufeind Tested-by: Stefan Neufeind Reviewed-by: Steffen Ritter Tested-by: Steffen Ritter --- t3lib/class.t3lib_extmgm.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/t3lib/class.t3lib_extmgm.php b/t3lib/class.t3lib_extmgm.php index 6a7a13fe4621..c32deda3658e 100644 --- a/t3lib/class.t3lib_extmgm.php +++ b/t3lib/class.t3lib_extmgm.php @@ -212,12 +212,18 @@ final class t3lib_extMgm { if (!self::isLoaded($key)) { return ''; } + $runtimeCache = $GLOBALS['typo3CacheManager']->getCache('cache_runtime'); + $cacheIdentifier = 'extMgmExtVersion-' . $key; - $EM_CONF = array(); - $_EXTKEY = $key; - include(self::extPath($key) . 'ext_emconf.php'); + if (!($extensionVersion = $runtimeCache->get($cacheIdentifier))) { - return $EM_CONF[$key]['version']; + $EM_CONF = array(); + $_EXTKEY = $key; + include(self::extPath($key) . 'ext_emconf.php'); + $extensionVersion = $EM_CONF[$key]['version']; + $runtimeCache->set($cacheIdentifier, $extensionVersion); + } + return $extensionVersion; } @@ -244,7 +250,7 @@ final class t3lib_extMgm { public static function addTCAcolumns($table, $columnArray, $addTofeInterface = 0) { t3lib_div::loadTCA($table); if (is_array($columnArray) && is_array($GLOBALS['TCA'][$table]) && is_array($GLOBALS['TCA'][$table]['columns'])) { - // Candidate for t3lib_div::array_merge() if integer-keys will some day make trouble... + // Candidate for t3lib_div::array_merge() if integer-keys will some day make trouble... $GLOBALS['TCA'][$table]['columns'] = array_merge($GLOBALS['TCA'][$table]['columns'], $columnArray); if ($addTofeInterface) { $GLOBALS['TCA'][$table]['feInterface']['fe_admin_fieldList'] .= ',' . implode(',', array_keys($columnArray)); @@ -1205,8 +1211,8 @@ final class t3lib_extMgm { $pluginContent = trim(' plugin.' . $cN . $prefix . ' = USER' . ($cached ? '' : '_INT') . ' plugin.' . $cN . $prefix . ' { - includeLibs = ' . $GLOBALS['TYPO3_LOADED_EXT'][$key]['siteRelPath'] . $classFile . ' - userFunc = ' . $cN . $prefix . '->main + includeLibs = ' . $GLOBALS['TYPO3_LOADED_EXT'][$key]['siteRelPath'] . $classFile . ' + userFunc = ' . $cN . $prefix . '->main }'); self::addTypoScript($key, 'setup', ' # Setting ' . $key . ' plugin TypoScript -- GitLab