|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2008-2011 Benjamin Mack <benni@typo3.org> 00006 * (c) 2008-2011 Steffen Kamper <info@sk-typo3.de> 00007 * All rights reserved 00008 * 00009 * This script is part of the TYPO3 project. The TYPO3 project is 00010 * free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * The GNU General Public License can be found at 00016 * http://www.gnu.org/copyleft/gpl.html. 00017 * A copy is found in the textfile GPL.txt and important notices to the license 00018 * from the author is found in LICENSE.txt distributed with these scripts. 00019 * 00020 * 00021 * This script is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 * GNU General Public License for more details. 00025 * 00026 * This copyright notice MUST APPEAR in all copies of the script! 00027 ***************************************************************/ 00028 00029 /** 00030 * Contains the update class for adding the system extension "simulate static". 00031 * 00032 * $Id: class.tx_coreupdates_installnewsysexts.php 10335 2011-01-26 16:41:07Z stephenking $ 00033 * 00034 * @author Benjamin Mack <benni@typo3.org> 00035 * @author Steffen Kamper <info@sk-typo3.de> 00036 */ 00037 class tx_coreupdates_installnewsysexts extends Tx_Install_Updates_Base { 00038 protected $title = 'Install New System Extensions'; 00039 protected $newSystemExtensions = array('recycler', 't3editor', 'reports', 'scheduler'); 00040 00041 /** 00042 * Checks if an update is needed 00043 * 00044 * @param string &$description: The description for the update 00045 * @return boolean whether an update is needed (true) or not (false) 00046 */ 00047 public function checkForUpdate(&$description) { 00048 $result = FALSE; 00049 $description = ' 00050 <p> 00051 Install the following system extensions that are new since TYPO3 00052 4.3: 00053 </p> 00054 '; 00055 00056 $description .= ' 00057 <ul> 00058 '; 00059 00060 foreach($this->newSystemExtensions as $_EXTKEY) { 00061 if (!t3lib_extMgm::isLoaded($_EXTKEY)) { 00062 $EM_CONF = FALSE; 00063 // extension may not been loaded at this point, so we can't use an API function from t3lib_extmgm 00064 require (PATH_site . 'typo3/sysext/' . $_EXTKEY . '/ext_emconf.php'); 00065 $description .= ' 00066 <li> 00067 <strong> 00068 ' . $EM_CONF[$_EXTKEY]['title'] . ' [' . $_EXTKEY . '] 00069 </strong> 00070 <br /> 00071 ' . $EM_CONF[$_EXTKEY]['description'] . ' 00072 </li> 00073 '; 00074 00075 $result = TRUE; 00076 } 00077 } 00078 00079 $description .= ' 00080 </ul> 00081 '; 00082 if ($this->isWizardDone()) { 00083 $result = FALSE; 00084 } 00085 00086 return $result; 00087 } 00088 00089 /** 00090 * second step: get user input for installing sysextensions 00091 * 00092 * @param string input prefix, all names of form fields have to start with this. Append custom name in [ ... ] 00093 * @return string HTML output 00094 */ 00095 public function getUserInput($inputPrefix) { 00096 $content = ' 00097 <p> 00098 <strong> 00099 Install the following system extensions that are new in 00100 TYPO3 4.3: 00101 </strong> 00102 </p> 00103 '; 00104 00105 $content .= ' 00106 <fieldset> 00107 <ol> 00108 '; 00109 00110 foreach($this->newSystemExtensions as $_EXTKEY) { 00111 if (!t3lib_extMgm::isLoaded($_EXTKEY)) { 00112 $EM_CONF = FALSE; 00113 // extension may not been loaded at this point, so we can't use an API function from t3lib_extmgm 00114 require (PATH_site . 'typo3/sysext/' . $_EXTKEY . '/ext_emconf.php'); 00115 $content .= ' 00116 <li class="labelAfter"> 00117 <input type="checkbox" id="' . $_EXTKEY . '" name="' . $inputPrefix . '[sysext][' . $_EXTKEY . ']" value="1" checked="checked" /> 00118 <label for="' . $_EXTKEY . '">' . $EM_CONF[$_EXTKEY]['title'] . ' [' . $_EXTKEY . ']</label> 00119 </li> 00120 '; 00121 } 00122 } 00123 00124 $content .= ' 00125 </ol> 00126 </fieldset> 00127 '; 00128 00129 return $content; 00130 } 00131 00132 /** 00133 * Adds the extensions "about", "cshmanual" and "simulatestatic" to the extList in TYPO3_CONF_VARS 00134 * 00135 * @param array &$dbQueries: queries done in this update 00136 * @param mixed &$customMessages: custom messages 00137 * @return boolean whether it worked (true) or not (false) 00138 */ 00139 public function performUpdate(&$dbQueries, &$customMessages) { 00140 00141 // Get extension keys that were submitted by the user to be installed and that are valid for this update wizard 00142 if (is_array($this->pObj->INSTALL['update']['installNewSystemExtensions']['sysext'])) { 00143 $extArray = array_intersect( 00144 $this->newSystemExtensions, 00145 array_keys($this->pObj->INSTALL['update']['installNewSystemExtensions']['sysext']) 00146 ); 00147 $this->installExtensions($extArray); 00148 } 00149 00150 // Never show this wizard again 00151 $this->markWizardAsDone(); 00152 00153 return TRUE; 00154 } 00155 00156 00157 /** 00158 * Adds extension to extension list and returns new list. If -1 is returned, an error happend. 00159 * Does NOT check dependencies yet. 00160 * 00161 * @param array Extension keys to add 00162 * @return string New list of installed extensions or -1 if error 00163 * @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() 00164 */ 00165 function addExtToList(array $extKeys) { 00166 t3lib_div::logDeprecatedFunction(); 00167 // Get list of installed extensions and add this one. 00168 $tmpLoadedExt = $GLOBALS['TYPO3_LOADED_EXT']; 00169 if (isset($tmpLoadedExt['_CACHEFILE'])) { 00170 unset($tmpLoadedExt['_CACHEFILE']); 00171 } 00172 00173 $listArr = array_keys($tmpLoadedExt); 00174 $listArr = array_merge($listArr, $extKeys); 00175 00176 // Implode unique list of extensions to load and return: 00177 return implode(',', array_unique($listArr)); 00178 } 00179 00180 00181 /** 00182 * Writes the extension list to "localconf.php" file 00183 * Removes the temp_CACHED* files before return. 00184 * 00185 * @param string List of extensions 00186 * @return void 00187 * @deprecated since TYPO3 4.5, will be removed in TYPO3 4.7 - Use Tx_Install_Updates_Base::installExtensions() instead 00188 */ 00189 protected function writeNewExtensionList($newExtList) { 00190 t3lib_div::logDeprecatedFunction(); 00191 // Instance of install tool 00192 $instObj = new t3lib_install; 00193 $instObj->allowUpdateLocalConf = 1; 00194 $instObj->updateIdentity = 'TYPO3 Core Update Manager'; 00195 00196 // Get lines from localconf file 00197 $lines = $instObj->writeToLocalconf_control(); 00198 $instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $newExtList); 00199 $instObj->writeToLocalconf_control($lines); 00200 00201 $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $newExtList; 00202 t3lib_extMgm::removeCacheFiles(); 00203 } 00204 } 00205 ?>
1.8.0