2 namespace TYPO3\CMS\Install\Updates
;
4 /***************************************************************
7 * (c) 2010-2013 Michael Stucki <michael@typo3.org>, Benjamin Mack <benni@typo3.org>
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.
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.
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.
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
31 * Displays warnings and information about the database character set
33 class CharsetDefaultsUpdate
extends AbstractUpdate
{
38 protected $title = 'Database Character Set';
41 * Checks if the configuration is relying on old default values or not.
42 * If needed, this updater will fix the configuration appropriately.
44 * @param string &$description The description for the update
45 * @param string &$showUpdate 0=don't show update; 1=show update and next button; 2=only show description
46 * @return boolean Whether an update is needed (TRUE) or not (FALSE)
48 public function checkForUpdate(&$description, &$showUpdate = FALSE) {
49 if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit'] === '-1') {
50 $description = 'The configuration variables $TYPO3_CONF_VARS[\'SYS\'][\'setDBinit\']
51 is relying on empty default values.<br />
52 However, the default has changed in TYPO3 4.5.<br /><br />
53 Please click "Next" to write the former default settings to your localconf.php,
54 so that your setup will continue to work like before.';
60 * Write the current configuration to localconf.php
61 * This is needed for any sites that were relying on the former default
62 * values which are going to change in TYPO3 4.5.
64 * @param array &$dbQueries Queries done in this update
65 * @param mixed &$customMessages Custom messages
66 * @return boolean Whether the updated was made or not
68 public function performUpdate(array &$dbQueries, &$customMessages) {
69 // Update "setDBinit" setting
71 if (\TYPO3\CMS\Core\Utility\GeneralUtility
::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getLocalConfigurationValueByPath('SYS/setDBinit') === '-1') {
72 $result1 = \TYPO3\CMS\Core\Utility\GeneralUtility
::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('SYS/setDBinit', '');
75 $customMessages[] = 'The configuration was successfully updated.';