Fixed bug #12872: Use "strong" instead of "b": typo3/sysext/
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / updates / class.tx_coreupdates_statictemplates.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2008-2009 Steffen Ritter (info@rs-websystems.de)
6 * 2009 Benjamin Mack (benni@typo3.org)
7 * All rights reserved
8 *
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.
14 *
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.
19 *
20 *
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.
25 *
26 * This copyright notice MUST APPEAR in all copies of the script!
27 ***************************************************************/
28 /**
29 * Contains the update class for old static templates. Used by the update wizard in the install tool.
30 *
31 * @author Steffen Ritter <info@rs-websystems.de>
32 * @author Benjamin Mack <benni@typo3.org>
33 */
34 class tx_coreupdates_statictemplates {
35 public $versionNumber; // version number coming from t3lib_div::int_from_ver()
36 public $pObj; // parent object (tx_install)
37 public $userInput; // user input
38
39
40 /**
41 * Checks if there are any references to static_templates and an update is needed.
42 *
43 * @param string &$description: The description for the update
44 * @return boolean whether an update is needed (true) or not (false)
45 */
46 public function checkForUpdate(&$description) {
47 $description = '<strong>Check dependencies / references to old TypoScript templates in table static_template.</strong><br />
48 This updater checks if you are using the old TypoScript static templates. These are extracted into its own extension "statictemplates". If you need them, this updater will install this extension.<br /><br />';
49 if ($this->versionNumber >= 4004000 && !t3lib_extMgm::isLoaded('statictemplates')) {
50 $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
51 '*',
52 'sys_refindex',
53 'ref_table = "static_template" AND tablename != "static_template" AND deleted=0'
54 );
55 if ($count) {
56 $description .= '<strong style="color:#f00">Dependencies found! You MUST install the extenion "statictemplates"!</strong>';
57 return TRUE;
58 }
59 else {
60 $description .= 'No Dependencies found! You may use the COMPARE - Tool to delete the static_template table.';
61 }
62 }
63 return FALSE;
64 }
65
66 /**
67 * second step: get user info
68 *
69 * @param string input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
70 * @return string HTML output
71 */
72 public function getUserInput($inputPrefix) {
73 $content = '<strong>Install the system extension</strong><br />You are about to install the extension "statictemplates". Make sure it is available in the TYPO3 source.';
74
75 return $content;
76 }
77
78 /**
79 * performs the action of the UpdateManager
80 *
81 * @param array &$dbQueries: queries done in this update
82 * @param mixed &$customMessages: custom messages
83 * @return bool whether everything went smoothly or not
84 */
85 public function performUpdate(array &$dbQueries, &$customMessages) {
86 if ($this->versionNumber >= 4004000 && !t3lib_extMgm::isLoaded('statictemplates')) {
87 // check wether the table can be truncated or if sysext with tca has to be installed
88 if ($this->checkForUpdate($customMessages[])) {
89 $localconf = $this->pObj->writeToLocalconf_control();
90 $this->pObj->setValueInLocalconfFile($localconf, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] . ',statictemplates');
91 $message = $this->pObj->writeToLocalconf_control($localconf);
92 if ($message == 'continue') {
93 $customMessages[] = 'System Extension "statictemplates" was succesfully loaded, static templates are now supported.';
94 return TRUE;
95 } else {
96 return FALSE; // something went wrong
97 }
98 }
99 return TRUE;
100 }
101 }
102 }
103 ?>