|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2010-2011 Steffen Ritter (info@rs-websystems.de) 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00027 /** 00028 * Contains the update class for not installed t3skin. Used by the update wizard in the install tool. 00029 * 00030 * @author Steffen Ritter <info@rs-websystems.de> 00031 */ 00032 class tx_coreupdates_t3skin extends Tx_Install_Updates_Base { 00033 protected $title = 'Install the new TYPO3 Skin "t3skin"'; 00034 00035 00036 /** 00037 * Checks if t3skin is not installed. 00038 * 00039 * @param string &$description: The description for the update 00040 * @return boolean whether an update is needed (true) or not (false) 00041 */ 00042 public function checkForUpdate(&$description) { 00043 $result = FALSE; 00044 $description = '<strong>The backend skin "t3skin" is not loaded.</strong> 00045 TYPO3 4.4 introduced many changes in backend skinning and old backend skins are now incompatible. 00046 <strong>Without "t3skin" the backend may be unusable.</strong> Install extension "t3skin".'; 00047 if (!t3lib_extMgm::isLoaded('t3skin')) { 00048 $result = TRUE; 00049 } 00050 return $result; 00051 } 00052 00053 /** 00054 * second step: get user info 00055 * 00056 * @param string input prefix, all names of form fields have to start with this. Append custom name in [ ... ] 00057 * @return string HTML output 00058 */ 00059 public function getUserInput($inputPrefix) { 00060 $content = '<strong>Install the system extension</strong><br />You are about to install the extension "t3skin".'; 00061 00062 return $content; 00063 } 00064 00065 /** 00066 * performs the action of the UpdateManager 00067 * 00068 * @param array &$dbQueries: queries done in this update 00069 * @param mixed &$customMessages: custom messages 00070 * @return bool whether everything went smoothly or not 00071 */ 00072 public function performUpdate(array &$dbQueries, &$customMessages) { 00073 $result = FALSE; 00074 if ($this->versionNumber >= 4004000 && !t3lib_extMgm::isLoaded('t3skin')) { 00075 // check wether the table can be truncated or if sysext with tca has to be installed 00076 if ($this->checkForUpdate($customMessages[])) { 00077 $extList = $this->addExtToList(array('t3skin')); 00078 if ($extList) { 00079 $message = $this->writeNewExtensionList($extList); 00080 } 00081 00082 if ($message == 'continue') { 00083 $customMessages = 'The system extension "t3skin" was succesfully loaded.'; 00084 $result = TRUE; 00085 } 00086 } 00087 } 00088 return $result; 00089 } 00090 00091 /** 00092 * Adds extension to extension list and returns new list. If -1 is returned, an error happend. 00093 * Does NOT check dependencies yet. 00094 * 00095 * @param array Extension keys to add 00096 * @return string New list of installed extensions or -1 if error 00097 */ 00098 protected function addExtToList(array $extKeys) { 00099 // Get list of installed extensions and add this one. 00100 $tmpLoadedExt = $GLOBALS['TYPO3_LOADED_EXT']; 00101 if (isset($tmpLoadedExt['_CACHEFILE'])) { 00102 unset($tmpLoadedExt['_CACHEFILE']); 00103 } 00104 00105 $listArr = array_keys($tmpLoadedExt); 00106 $listArr = array_merge($listArr, $extKeys); 00107 00108 // Implode unique list of extensions to load and return: 00109 return implode(',', array_unique($listArr)); 00110 } 00111 00112 00113 /** 00114 * Writes the extension list to "localconf.php" file 00115 * Removes the temp_CACHED* files before return. 00116 * 00117 * @param string List of extensions 00118 * @return string Result of writeToLocalconf_control() 00119 */ 00120 protected function writeNewExtensionList($newExtList) { 00121 // Instance of install tool 00122 $instObj = new t3lib_install; 00123 $instObj->allowUpdateLocalConf = 1; 00124 $instObj->updateIdentity = 'TYPO3 Core Update Manager'; 00125 00126 // Get lines from localconf file 00127 $lines = $instObj->writeToLocalconf_control(); 00128 $instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $newExtList); 00129 $result = $instObj->writeToLocalconf_control($lines); 00130 00131 $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $newExtList; 00132 t3lib_extMgm::removeCacheFiles(); 00133 00134 return $result; 00135 } 00136 } 00137 ?>
1.8.0