Index: typo3/sysext/install/Classes/Updates/Base.php =================================================================== --- typo3/sysext/install/Classes/Updates/Base.php (Revision 10144) +++ typo3/sysext/install/Classes/Updates/Base.php (Arbeitskopie) @@ -187,8 +187,38 @@ $res = $this->checkForUpdate($explanation, $showUpdate); return ($showUpdate != 2 || $res == TRUE); } - + /** + * This method creates an instance of a connection to the Extension Manager + * and returns it. This is used when installing an extension. + * + * @return tx_em_Connection_ExtDirectServer EM connection instance + */ + public function getExtensionManagerConnection() { + // Create an instance of language, if necessary. + // Needed in order to make the em_index work + if (!isset($GLOBALS['LANG'])) { + $GLOBALS['LANG'] = t3lib_div::makeInstance('language'); + $GLOBALS['LANG']->csConvObj = t3lib_div::makeInstance('t3lib_cs'); + } + // Create an instance of a connection class to the EM + $extensionManagerConnection = t3lib_div::makeInstance('tx_em_Connection_ExtDirectServer', FALSE); + return $extensionManagerConnection; + } + + /** + * This method can be called to install extensions following all proper processes + * (e.g. installing in both extList and extList_FE, respecting priority, etc.) + * + * @param array $extensionKeys List of keys of extensions to install + * @return void + */ + protected function installExtensions($extensionKeys) { + $extensionManagerConnection = $this->getExtensionManagerConnection(); + foreach ($extensionKeys as $extension) { + $extensionManagerConnection->enableExtension($extension); + } + } + } - ?> Index: typo3/sysext/install/updates/class.tx_coreupdates_installsysexts.php =================================================================== --- typo3/sysext/install/updates/class.tx_coreupdates_installsysexts.php (Revision 10144) +++ typo3/sysext/install/updates/class.tx_coreupdates_installsysexts.php (Arbeitskopie) @@ -179,33 +179,31 @@ * @return boolean whether it worked (true) or not (false) */ public function performUpdate(&$dbQueries, &$customMessages) { - $result = false; + $result = FALSE; - // Get extension keys that were submitted by the used to be installed and that are valid for this update wizard: + // Get extension keys that were submitted by the user to be installed and that are valid for this update wizard if (is_array($this->pObj->INSTALL['update']['installSystemExtensions']['sysext'])) { $extArray = array_intersect( $this->newSystemExtensions, array_keys($this->pObj->INSTALL['update']['installSystemExtensions']['sysext']) ); - $extList = $this->addExtToList($extArray); - if ($extList) { - $this->writeNewExtensionList($extList); - $result = true; - } + $this->installExtensions($extArray); + $result = 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 + * @deprecated since TYPO3 4.5, will be removed in TYPO3 4.7 - Should not be needed anymore. Extensions should be installed directly by calling Tx_Install_Updates_Base::installExtensions() */ function addExtToList(array $extKeys) { + t3lib_div::logDeprecatedFunction(); // Get list of installed extensions and add this one. $tmpLoadedExt = $GLOBALS['TYPO3_LOADED_EXT']; if (isset($tmpLoadedExt['_CACHEFILE'])) { @@ -226,8 +224,10 @@ * * @param string List of extensions * @return void + * @deprecated since TYPO3 4.5, will be removed in TYPO3 4.7 - Use Tx_Install_Updates_Base::installExtensions() instead */ - protected function writeNewExtensionList($newExtList) { + protected function writeNewExtensionList($newExtList) { + t3lib_div::logDeprecatedFunction(); // Instance of install tool $instObj = new t3lib_install; $instObj->allowUpdateLocalConf = 1; Index: typo3/sysext/install/updates/class.tx_coreupdates_installnewsysexts.php =================================================================== --- typo3/sysext/install/updates/class.tx_coreupdates_installnewsysexts.php (Revision 10144) +++ typo3/sysext/install/updates/class.tx_coreupdates_installnewsysexts.php (Arbeitskopie) @@ -134,19 +134,16 @@ * @return boolean whether it worked (true) or not (false) */ public function performUpdate(&$dbQueries, &$customMessages) { - $result = false; + $result = FALSE; - // Get extension keys that were submitted by the used to be installed and that are valid for this update wizard: + // Get extension keys that were submitted by the user to be installed and that are valid for this update wizard if (is_array($this->pObj->INSTALL['update']['installNewSystemExtensions']['sysext'])) { $extArray = array_intersect( $this->newSystemExtensions, array_keys($this->pObj->INSTALL['update']['installNewSystemExtensions']['sysext']) ); - $extList = $this->addExtToList($extArray); - if ($extList) { - $this->writeNewExtensionList($extList); - $result = true; - } + $this->installExtensions($extArray); + $result = TRUE; } return $result; @@ -159,8 +156,10 @@ * * @param array Extension keys to add * @return string New list of installed extensions or -1 if error + * @deprecated since TYPO3 4.5, will be removed in TYPO3 4.7 - Should not be needed anymore. Extensions should be installed directly by calling Tx_Install_Updates_Base::installExtensions() */ function addExtToList(array $extKeys) { + t3lib_div::logDeprecatedFunction(); // Get list of installed extensions and add this one. $tmpLoadedExt = $GLOBALS['TYPO3_LOADED_EXT']; if (isset($tmpLoadedExt['_CACHEFILE'])) { @@ -181,8 +180,10 @@ * * @param string List of extensions * @return void + * @deprecated since TYPO3 4.5, will be removed in TYPO3 4.7 - Use Tx_Install_Updates_Base::installExtensions() instead */ - protected function writeNewExtensionList($newExtList) { + protected function writeNewExtensionList($newExtList) { + t3lib_div::logDeprecatedFunction(); // Instance of install tool $instObj = new t3lib_install; $instObj->allowUpdateLocalConf = 1;