[TASK] Remove last bits of forceCharset handling
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / CoreUpdates / CharsetDefaultsUpdate.php
1 <?php
2 namespace TYPO3\CMS\Install\CoreUpdates;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2010-2013 Michael Stucki <michael@typo3.org>, Benjamin Mack <benni@typo3.org>
8 * All rights reserved
9 *
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.
15 *
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.
20 *
21 *
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.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29 /**
30 * Displays warnings and information about the database character set
31 */
32 class CharsetDefaultsUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
33
34 protected $title = 'Database Character Set';
35
36 /**
37 * Checks if the configuration is relying on old default values or not.
38 * If needed, this updater will fix the configuration appropriately.
39 *
40 * @param string &$description: The description for the update
41 * @param string &$showUpdate: 0=dont show update; 1=show update and next button; 2=only show description
42 * @return boolean whether an update is needed (TRUE) or not (FALSE)
43 */
44 public function checkForUpdate(&$description, &$showUpdate = FALSE) {
45 if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit'] === '-1') {
46 $description = 'The configuration variables $TYPO3_CONF_VARS[\'SYS\'][\'setDBinit\']
47 is relying on empty default values.<br />
48 However, the default has changed in TYPO3 4.5.<br /><br />
49 Please click "Next" to write the former default settings to your localconf.php,
50 so that your setup will continue to work like before.';
51 $showUpdate = 1;
52 }
53 }
54
55 /**
56 * Write the current configuration to localconf.php
57 * This is needed for any sites that were relying on the former default
58 * values which are going to change in TYPO3 4.5.
59 *
60 * @param array &$dbQueries: queries done in this update
61 * @param mixed &$customMessages: custom messages
62 * @return boolean whether the updated was made or not
63 */
64 public function performUpdate(array &$dbQueries, &$customMessages) {
65 // Update "setDBinit" setting
66 $result1 = FALSE;
67 if (\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getLocalConfigurationValueByPath('SYS/setDBinit') === '-1') {
68 $result1 = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('SYS/setDBinit', '');
69 }
70 if ($result1) {
71 $customMessages[] = 'The configuration was successfully updated.';
72 return TRUE;
73 } else {
74 return FALSE;
75 }
76 }
77
78 }
79
80
81 ?>