2 /***************************************************************
5 * (c) 2008 Benjamin Mack <benni@typo3.org>
6 * (c) 2008 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 the system extension "simulate static".
34 * @author Benjamin Mack <benni@typo3.org>
35 * @author Steffen Kamper <info@sk-typo3.de>
37 class tx_coreupdates_installsysexts
{
38 public $versionNumber; // version number coming from t3lib_div::int_from_ver()
39 public $newSystemExtensions = array('about', 'cshmanual', 'feedit', 'simulatestatic');
47 public $userInput; // user input
51 * Checks if an update is needed
53 * @param string &$description: The description for the update
54 * @return boolean whether an update is needed (true) or not (false)
56 public function checkForUpdate(&$description) {
58 $description = 'Install the following system extensions as their functionality is moved out of the TYPO3 base installation and now optional:<br />
59 <strong>Help>About [about]</strong><br />Shows info about TYPO3 and installed extensions.<br />
60 <strong>Help>TYPO3 Manual [cshmanual]</strong><br />Shows TYPO3 inline user manual.<br />
61 <strong>Frontend Editing [fe_edit]</strong><br />This module enables FE-editing, configuration is done by Typoscript<br />
62 <strong>Simulate Static URLs [simulatestatic]</strong><br />If you do not want to use RealURL or CoolURI but still want the Speaking URL feature. If you used "config.simulateStaticDocuments = 1" in this installation before, you should install this system extension. Be sure to read the manual of "simulatestatic".</label>';
64 foreach($this->newSystemExtensions
as $ext) {
65 if (!t3lib_extMgm
::isLoaded($ext)) {
73 * second step: get user input for installing sysextensions
75 * @param string input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
76 * @return string HTML output
78 public function getUserInput($inputPrefix) {
80 $content = '<strong>Install the following SystemExtensions</strong>:<br />
81 <input type="checkbox" id="about" name="' . $inputPrefix . '[sysext][about]" value="1" checked="checked" /><label for="about">Help>About [about]</label><br />
82 <input type="checkbox" id="cshmanual" name="' . $inputPrefix . '[sysext][cshmanual]" value="1" checked="checked" /><label for="cshmanual">Help>TYPO3 Manual [cshmanual]</label><br />
83 <input type="checkbox" id="fe_edit" name="' . $inputPrefix . '[sysext][fe_edit]" value="1" checked="checked" /><label for="fe_edit">Frontend Editing [fe_edit]</label><br />
84 <input type="checkbox" id="simulatestatic" name="' . $inputPrefix . '[sysext][simulatestatic]" value="1" checked="checked" /><label for="simulatestatic">Simulate Static URLs [simulatestatic]</label><br />';
90 * Adds the extensions "about", "cshmanual" and "simulatestatic" to the extList in TYPO3_CONF_VARS
92 * @param array &$dbQueries: queries done in this update
93 * @param mixed &$customMessages: custom messages
94 * @return boolean whether it worked (true) or not (false)
96 public function performUpdate(&$dbQueries, &$customMessages) {
98 $extArray = (array) array_keys($this->pObj
->INSTALL
['update']['installSystemExtensions']['sysext']);
100 $extList = $this->addExtToList($extArray);
102 $this->writeNewExtensionList($extList);
110 * Adds extension to extension list and returns new list. If -1 is returned, an error happend.
111 * Does NOT check dependencies yet.
113 * @param array Extension keys to add
114 * @return string New list of installed extensions or -1 if error
116 function addExtToList(array $extKeys) {
117 // Get list of installed extensions and add this one.
118 $listArr = array_keys($GLOBALS['TYPO3_LOADED_EXT']);
119 $listArr = array_merge($listArr, $extKeys);
121 // Implode unique list of extensions to load and return:
122 return implode(',', array_unique($listArr));
127 * Writes the extension list to "localconf.php" file
128 * Removes the temp_CACHED* files before return.
130 * @param string List of extensions
133 protected function writeNewExtensionList($newExtList) {
134 // Instance of install tool
135 $instObj = new t3lib_install
;
136 $instObj->allowUpdateLocalConf
= 1;
137 $instObj->updateIdentity
= 'TYPO3 Core Update Manager';
139 // Get lines from localconf file
140 $lines = $instObj->writeToLocalconf_control();
141 $instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $newExtList);
142 $instObj->writeToLocalconf_control($lines);
144 $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $newExtList;
145 t3lib_extMgm
::removeCacheFiles();