|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2010-2011 Michael Stucki <michael@typo3.org>, Benjamin Mack <benni@typo3.org> 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 /** 00029 * Displays warnings and information about the database character set 00030 * 00031 * @version $Id$ 00032 */ 00033 class tx_coreupdates_charsetDefaults extends Tx_Install_Updates_Base { 00034 protected $title = 'Database Character Set'; 00035 00036 /** 00037 * Checks if the configuration is relying on old default values or not. 00038 * If needed, this updater will fix the configuration appropriately. 00039 * 00040 * @param string &$description: The description for the update 00041 * @param string &$showUpdate: 0=dont show update; 1=show update and next button; 2=only show description 00042 * @return boolean whether an update is needed (true) or not (false) 00043 */ 00044 public function checkForUpdate(&$description, &$showUpdate = FALSE) { 00045 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] === '-1' || 00046 $GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit'] === '-1') { 00047 00048 $description = 'The configuration variables $TYPO3_CONF_VARS[\'SYS\'][\'setDBinit\'] and/or 00049 $TYPO3_CONF_VARS[\'BE\'][\'forceCharset\'] are relying on empty default values.<br /> 00050 However, the defaults for both values have changed in TYPO3 4.5.<br /><br /> 00051 Please click "Next" to write the former default settings to your localconf.php, 00052 so that your setup will continue to work like before.'; 00053 $showUpdate = 1; 00054 } 00055 } 00056 00057 00058 /** 00059 * Write the current configuration to localconf.php 00060 * This is needed for any sites that were relying on the former default 00061 * values which are going to change in TYPO3 4.5. 00062 * 00063 * @param array &$dbQueries: queries done in this update 00064 * @param mixed &$customMessages: custom messages 00065 * @return boolean whether the updated was made or not 00066 */ 00067 public function performUpdate(array &$dbQueries, &$customMessages) { 00068 $localconf = $this->pObj->writeToLocalconf_control(); 00069 00070 // Update "setDBinit" setting 00071 if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit'] === '-1') { 00072 $this->pObj->setValueInLocalconfFile($localconf, '$TYPO3_CONF_VARS[\'SYS\'][\'setDBinit\']', ''); 00073 } 00074 00075 // Update the "forceCharset" setting 00076 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] === '-1') { 00077 $this->pObj->setValueInLocalconfFile($localconf, '$TYPO3_CONF_VARS[\'BE\'][\'forceCharset\']', ''); 00078 } 00079 00080 $message = $this->pObj->writeToLocalconf_control($localconf); 00081 if ($message == 'continue') { 00082 $customMessages[] = 'The configuration was successfully updated.'; 00083 return TRUE; 00084 } else { 00085 return FALSE; // something went wrong 00086 } 00087 } 00088 } 00089 00090 ?>
1.8.0