Index: typo3/sysext/install/updates/class.tx_coreupdates_t3skin.php =================================================================== --- typo3/sysext/install/updates/class.tx_coreupdates_t3skin.php (revision 7980) +++ typo3/sysext/install/updates/class.tx_coreupdates_t3skin.php (working copy) @@ -42,13 +42,14 @@ * @return boolean whether an update is needed (true) or not (false) */ public function checkForUpdate(&$description) { + $result = FALSE; $description = 'The backend skin "t3skin" is not loaded. TYPO3 4.4 introduced many changes in backend skinning and old backend skins are now incompatible. Without "t3skin" the backend may be unusable. Install extension "t3skin".'; if (!t3lib_extMgm::isLoaded('t3skin')) { - return TRUE; + $result = TRUE; } - return FALSE; + return $result; } /** @@ -71,21 +72,68 @@ * @return bool whether everything went smoothly or not */ public function performUpdate(array &$dbQueries, &$customMessages) { + $result = FALSE; if ($this->versionNumber >= 4004000 && !t3lib_extMgm::isLoaded('t3skin')) { // check wether the table can be truncated or if sysext with tca has to be installed if ($this->checkForUpdate($customMessages[])) { - $localconf = $this->pObj->writeToLocalconf_control(); - $this->pObj->setValueInLocalconfFile($localconf, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] . ',t3skin'); - $message = $this->pObj->writeToLocalconf_control($localconf); + $extList = $this->addExtToList(array('t3skin')); + if ($extList) { + $message = $this->writeNewExtensionList($extList); + } + if ($message == 'continue') { $customMessages = 'The system extension "t3skin" was succesfully loaded.'; - return TRUE; - } else { - return FALSE; // something went wrong + $result = TRUE; } + } } - return TRUE; + return $result; + } + + /** + * Adds extension to extension list and returns new list. If -1 is returned, an error happend. + * Does NOT check dependencies yet. + * + * @param array Extension keys to add + * @return string New list of installed extensions or -1 if error + */ + protected function addExtToList(array $extKeys) { + // Get list of installed extensions and add this one. + $tmpLoadedExt = $GLOBALS['TYPO3_LOADED_EXT']; + if (isset($tmpLoadedExt['_CACHEFILE'])) { + unset($tmpLoadedExt['_CACHEFILE']); } + + $listArr = array_keys($tmpLoadedExt); + $listArr = array_merge($listArr, $extKeys); + + // Implode unique list of extensions to load and return: + return implode(',', array_unique($listArr)); + } + + + /** + * Writes the extension list to "localconf.php" file + * Removes the temp_CACHED* files before return. + * + * @param string List of extensions + * @return string Result of writeToLocalconf_control() + */ + protected function writeNewExtensionList($newExtList) { + // Instance of install tool + $instObj = new t3lib_install; + $instObj->allowUpdateLocalConf = 1; + $instObj->updateIdentity = 'TYPO3 Core Update Manager'; + + // Get lines from localconf file + $lines = $instObj->writeToLocalconf_control(); + $instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $newExtList); + $result = $instObj->writeToLocalconf_control($lines); + + $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $newExtList; + t3lib_extMgm::removeCacheFiles(); + + return $result; } } ?> \ No newline at end of file