Fixed bug #17775: Compression Level Upgrade Wizard refers to old .htaccess path ...
[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 if (intval($GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel']) > 0) {
47 return TRUE;
48 }
49 return FALSE;
50 }
51
52 /**
53 * second step: get user info
54 *
55 * @param string input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
56 * @return string HTML output
57 */
58 public function getUserInput($inputPrefix) {
59 $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.
60 <br /><br />
61 <pre>
62 &lt;FilesMatch "\.js\.gzip$"&gt;
63 AddType "text/javascript" .gzip
64 &lt;/FilesMatch&gt;
65 &lt;FilesMatch "\.css\.gzip$"&gt;
66 AddType "text/css" .gzip
67 &lt;/FilesMatch&gt;
68 AddEncoding gzip .gzip
69 </pre></p>';
70
71 return $content;
72 }
73
74 /**
75 * performs the action of the UpdateManager
76 *
77 * @param array &$dbQueries: queries done in this update
78 * @param mixed &$customMessages: custom messages
79 * @return bool whether everything went smoothly or not
80 */
81 public function performUpdate(array &$dbQueries, &$customMessages) {
82 $customMessages = 'Cannot automatically fix this problem! Please check manually.';
83 return FALSE;
84 }
85 }
86 ?>