[BUGFIX] SQL error in install tool if no root page available
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Updates / T3skinUpdate.php
1 <?php
2 namespace TYPO3\CMS\Install\Updates;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2010-2013 Steffen Ritter (info@rs-websystems.de)
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the textfile GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29
30 /**
31 * Contains the update class for not installed t3skin. Used by the update wizard in the install tool.
32 *
33 * @author Steffen Ritter <info@rs-websystems.de>
34 */
35 class T3skinUpdate extends AbstractUpdate {
36
37 /**
38 * @var string
39 */
40 protected $title = 'Install the new TYPO3 Skin "t3skin"';
41
42 /**
43 * Checks if t3skin is not installed.
44 *
45 * @param string &$description The description for the update
46 * @return boolean Whether an update is needed (TRUE) or not (FALSE)
47 */
48 public function checkForUpdate(&$description) {
49 $result = FALSE;
50 $description[] = '<strong>The backend skin "t3skin" is not loaded.</strong>
51 TYPO3 4.4 introduced many changes in backend skinning and old backend skins are now incompatible.
52 <strong>Without "t3skin" the backend may be unusable.</strong> Install extension "t3skin".';
53 if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('t3skin')) {
54 $result = TRUE;
55 }
56 return $result;
57 }
58
59 /**
60 * second step: get user info
61 *
62 * @param string Input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
63 * @return string HTML output
64 */
65 public function getUserInput($inputPrefix) {
66 $content = '<strong>Install the system extension</strong><br />You are about to install the extension "t3skin".';
67 return $content;
68 }
69
70 /**
71 * performs the action of the UpdateManager
72 *
73 * @param array &$dbQueries Queries done in this update
74 * @param mixed &$customMessages Custom messages
75 * @return boolean Whether everything went smoothly or not
76 */
77 public function performUpdate(array &$dbQueries, &$customMessages) {
78 $result = FALSE;
79 if ($this->versionNumber >= 4004000 && !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('t3skin')) {
80 // check wether the table can be truncated or if sysext with tca has to be installed
81 if ($this->checkForUpdate($customMessages)) {
82 try {
83 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::loadExtension('t3skin');
84 $customMessages = 'The system extension "t3skin" was successfully loaded.';
85 $result = TRUE;
86 } catch (\RuntimeException $e) {
87 $result = FALSE;
88 }
89 }
90 }
91 return $result;
92 }
93
94 }
95
96 ?>