2 /***************************************************************
5 * (c) 2008-2011 Benjamin Mack <benni@typo3.org>
6 * (c) 2008-2011 Steffen Kamper <info@sk-typo3.de>
9 * This script is part of the TYPO3 project. The TYPO3 project is
10 * free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * The GNU General Public License can be found at
16 * http://www.gnu.org/copyleft/gpl.html.
17 * A copy is found in the textfile GPL.txt and important notices to the license
18 * from the author is found in LICENSE.txt distributed with these scripts.
21 * This script is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * This copyright notice MUST APPEAR in all copies of the script!
27 ***************************************************************/
30 * Contains the update class for adding outsourced system extensions.
32 * @author Benjamin Mack <benni@typo3.org>
33 * @author Steffen Kamper <info@sk-typo3.de>
35 class tx_coreupdates_installsysexts
extends Tx_Install_Updates_Base
{
36 protected $title = 'Install Outsourced System Extensions';
37 protected $outsourcedSystemExtensions = array('info', 'perm', 'func', 'filelist', 'about', 'cshmanual', 'feedit', 'opendocs', 'simulatestatic');
40 * Checks if an update is needed
42 * @param string &$description: The description for the update
43 * @return boolean whether an update is needed (TRUE) or not (FALSE)
45 public function checkForUpdate(&$description) {
52 foreach($this->outsourcedSystemExtensions
as $_EXTKEY) {
53 if (!t3lib_extMgm
::isLoaded($_EXTKEY)) {
55 // extension may not been loaded at this point, so we can't use an API function from t3lib_extmgm
56 require_once(PATH_site
. 'typo3/sysext/' . $_EXTKEY . '/ext_emconf.php');
60 ' . htmlspecialchars($EM_CONF[$_EXTKEY]['title']) . ' [' . $_EXTKEY . ']
63 ' . htmlspecialchars($EM_CONF[$_EXTKEY]['description']) . '
74 if ($this->isWizardDone()) {
82 * second step: get user input for installing sysextensions
84 * @param string $inputPrefix input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
85 * @return string HTML output
87 public function getUserInput($inputPrefix) {
91 Install the following SystemExtensions:
101 foreach($this->outsourcedSystemExtensions
as $_EXTKEY) {
102 if (!t3lib_extMgm
::isLoaded($_EXTKEY)) {
104 // extension may not been loaded at this point, so we can't use an API function from t3lib_extmgm
105 require_once(PATH_site
. 'typo3/sysext/' . $_EXTKEY . '/ext_emconf.php');
107 <li class="labelAfter">
108 <input type="checkbox" id="' . $_EXTKEY . '" name="' . $inputPrefix . '[sysext][' . $_EXTKEY . ']" value="1" checked="checked" />
109 <label for="' . $_EXTKEY . '">' . $EM_CONF[$_EXTKEY]['title'] . ' [' . $_EXTKEY . ']</label>
124 * Adds the outsourced extensions to the extList in TYPO3_CONF_VARS
126 * @param array &$dbQueries: queries done in this update
127 * @param mixed &$customMessages: custom messages
128 * @return boolean whether it worked (TRUE) or not (FALSE)
130 public function performUpdate(array &$dbQueries, &$customMessages) {
132 // Get extension keys that were submitted by the user to be installed and that are valid for this update wizard
133 if (is_array($this->pObj
->INSTALL
['update']['installSystemExtensions']['sysext'])) {
134 $extArray = array_intersect(
135 $this->outsourcedSystemExtensions
,
136 array_keys($this->pObj
->INSTALL
['update']['installSystemExtensions']['sysext'])
138 $this->installExtensions($extArray);
141 // Never show this wizard again
142 $this->markWizardAsDone();
148 * Adds extension to extension list and returns new list. If -1 is returned, an error happend.
149 * Does NOT check dependencies yet.
151 * @param array $extKeys Extension keys to add
152 * @return string New list of installed extensions or -1 if error
153 * @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()
155 function addExtToList(array $extKeys) {
156 t3lib_div
::logDeprecatedFunction();
157 // Get list of installed extensions and add this one.
158 $tmpLoadedExt = $GLOBALS['TYPO3_LOADED_EXT'];
159 if (isset($tmpLoadedExt['_CACHEFILE'])) {
160 unset($tmpLoadedExt['_CACHEFILE']);
163 $listArr = array_keys($tmpLoadedExt);
164 $listArr = array_merge($listArr, $extKeys);
166 // Implode unique list of extensions to load and return:
167 return implode(',', array_unique($listArr));
171 * Writes the extension list to "localconf.php" file
172 * Removes the temp_CACHED* files before return.
174 * @param string $newExtList List of extensions
176 * @deprecated since TYPO3 4.5, will be removed in TYPO3 4.7 - Use Tx_Install_Updates_Base::installExtensions() instead
178 protected function writeNewExtensionList($newExtList) {
179 t3lib_div
::logDeprecatedFunction();
180 // Instance of install tool
181 $instObj = new t3lib_install
;
182 $instObj->allowUpdateLocalConf
= 1;
183 $instObj->updateIdentity
= 'TYPO3 Core Update Manager';
185 // Get lines from localconf file
186 $lines = $instObj->writeToLocalconf_control();
187 $instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $newExtList);
188 $instObj->writeToLocalconf_control($lines);
190 $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $newExtList;
191 t3lib_extMgm
::removeCacheFiles();