[BUGFIX] Upgrade Wizards appear over and over again
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / updates / class.tx_coreupdates_compressionlevel.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010-2011 Steffen Ritter (info@rs-websystems.de)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Contains the update class checking against configured compressionlevel. Used by the update wizard in the install tool.
29 *
30 * @author Steffen Ritter <info@rs-websystems.de>
31 */
32 class tx_coreupdates_compressionlevel extends Tx_Install_Updates_Base {
33 protected $title = 'Check Compression Level';
34
35
36 /**
37 * Checks if there there is an compression level configured which may break the BE.
38 *
39 * @param string &$description: The description for the update
40 * @return boolean whether an update is needed (TRUE) or not (FALSE)
41 */
42 public function checkForUpdate(&$description) {
43 $description = '<p><strong>TYPO3_CONF_VARS[BE][compressionLevel] is enabled.</strong><br />
44 In TYPO3 4.4, compressionLevel was expanded to include automatic gzip compression of JavaScript and CSS stylessheet files.
45 <strong>To prevent the TYPO3 backend from being unusable, you must include the relevant lines from _.htaccess.</strong></p>';
46
47 if (!$this->isWizardDone() && intval($GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel']) > 0) {
48 return TRUE;
49 }
50 return FALSE;
51 }
52
53 /**
54 * second step: get user info
55 *
56 * @param string input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
57 * @return string HTML output
58 */
59 public function getUserInput($inputPrefix) {
60 $content = '<p><strong>This configuration cannot be fixed automatically and requires a manual update.</strong> Please include the following lines from _.htaccess on top of your .htacess file.
61 <br /><br />
62 <pre>
63 &lt;FilesMatch "\.js\.gzip$"&gt;
64 AddType "text/javascript" .gzip
65 &lt;/FilesMatch&gt;
66 &lt;FilesMatch "\.css\.gzip$"&gt;
67 AddType "text/css" .gzip
68 &lt;/FilesMatch&gt;
69 AddEncoding gzip .gzip
70 </pre></p>';
71
72 return $content;
73 }
74
75 /**
76 * performs the action of the UpdateManager
77 *
78 * @param array &$dbQueries: queries done in this update
79 * @param mixed &$customMessages: custom messages
80 * @return bool whether everything went smoothly or not
81 */
82 public function performUpdate(array &$dbQueries, &$customMessages) {
83 $customMessages = 'Cannot automatically fix this problem! Please check manually.';
84 $this->markWizardAsDone();
85 return FALSE;
86 }
87 }
88 ?>