TYPO3 API  SVNRelease
class.tx_coreupdates_compressionlevel.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2010-2011  Steffen Ritter (info@rs-websystems.de)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Contains the update class checking against configured compressionlevel. Used by the update wizard in the install tool.
00029  *
00030  * @author  Steffen Ritter <info@rs-websystems.de>
00031  */
00032 class tx_coreupdates_compressionlevel extends Tx_Install_Updates_Base {
00033     protected $title = 'Check Compression Level';
00034 
00035 
00036     /**
00037      * Checks if there there is an compression level configured which may break the BE.
00038      *
00039      * @param   string      &$description: The description for the update
00040      * @return  boolean     whether an update is needed (true) or not (false)
00041      */
00042     public function checkForUpdate(&$description) {
00043         $description = '<p><strong>TYPO3_CONF_VARS[BE][compressionLevel] is enabled.</strong><br />
00044         In TYPO3 4.4, compressionLevel was expanded to include automatic gzip compression of JavaScript and CSS stylessheet files.
00045         <strong>To prevent the TYPO3 backend from being unusable, you must include the relevant lines from _.htaccess.</strong></p>';
00046         if (intval($GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel']) > 0) {
00047             return TRUE;
00048         }
00049         return FALSE;
00050     }
00051 
00052     /**
00053      * second step: get user info
00054      *
00055      * @param   string      input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
00056      * @return  string      HTML output
00057      */
00058     public function getUserInput($inputPrefix) {
00059         $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.
00060                     <br /><br />
00061                     <pre>
00062 &lt;FilesMatch "\.js\.gzip$"&gt;
00063  AddType "text/javascript" .gzip
00064 &lt;/FilesMatch&gt;
00065 &lt;FilesMatch "\.css\.gzip$"&gt;
00066   AddType "text/css" .gzip
00067 &lt;/FilesMatch&gt;
00068 AddEncoding gzip .gzip
00069                     </pre></p>';
00070 
00071         return $content;
00072     }
00073 
00074     /**
00075      * performs the action of the UpdateManager
00076      *
00077      * @param   array       &$dbQueries: queries done in this update
00078      * @param   mixed       &$customMessages: custom messages
00079      * @return  bool        whether everything went smoothly or not
00080      */
00081     public function performUpdate(array &$dbQueries, &$customMessages) {
00082         $customMessages = 'Cannot automatically fix this problem! Please check manually.';
00083         return FALSE;
00084     }
00085 }
00086 ?>