Index: t3lib/config_default.php =================================================================== --- t3lib/config_default.php (Revision 9325) +++ t3lib/config_default.php (Arbeitskopie) @@ -88,8 +88,8 @@ 't3lib_cs_convMethod' => '', // String (values: "iconv", "recode", "mbstring", default is homemade PHP-code). Defines which of these PHP-features to use for various charset conversion functions in t3lib_cs. Will speed up charset conversion radically. 't3lib_cs_utils' => '', // String (values: "iconv", "mbstring", default is homemade PHP-code). Defines which of these PHP-features to use for various charset processing functions in t3lib_cs. Will speed up charset functions radically. 'no_pconnect' => FALSE, // Boolean: If true, "connect" is used instead of "pconnect" when connecting to the database! - 'multiplyDBfieldSize' => 1, // Double: 1-5: Amount used to multiply the DB field size when the install tool is evaluating the database size (eg. "2.5"). This is only useful e.g. if your database is iso-8859-1 encoded but you want to use utf-8 for your site. For Western European sites using utf-8 the need should not be for more than twice the normal single-byte size (2) and for Chinese / Asian languages 3 should suffice. NOTICE: It is recommended to change the native database charset instead! (see Wikipedia: UTF-8 support for more information) - 'setDBinit' => '', // String (textarea): Commands to send to database right after connecting, separated by newline. Ignored by the DBAL extension except for the 'native' type! + 'multiplyDBfieldSize' => 1, // Double: 1-5: Amount used to multiply the DB field size when the install tool is evaluating the database size (eg. "2.5"). This is only useful e.g. if your database is iso-8859-1 encoded but you want to use utf-8 for your site. For Western European sites using utf-8 the need should not be for more than twice the normal single-byte size (2) and for Chinese / Asian languages 3 should suffice. NOTICE: It is recommended to change the native database charset instead! (see Wikipedia: UTF-8 support for more information). NOTICE: This option is deprecated since TYPO3 4.5, and will not be used anymore in 4.7+. Please use proper tools to set your installation to UTF-8. + 'setDBinit' => '-1', // String (textarea): Commands to send to database right after connecting, separated by newline. Ignored by the DBAL extension except for the 'native' type! NOTICE: This option is deprecated since TYPO3 4.5, and will be removed in 4.7. Please use proper tools to set your installation to UTF-8. 'dbClientCompress' => FALSE, // Boolean: if true, data exchange between TYPO3 and database server will be compressed. This may improve performance if (1) database serever is on the different server and (2) network connection speed to database server is 100mbps or less. CPU usage will be higher if this option is used but database operations will be executed faster due to much less (up to 3 times) database network traffic. This option has no effect if MySQL server is localhost. 'setMemoryLimit' => 0, // Integer: memory_limit in MB: If more than 16, TYPO3 will try to use ini_set() to set the memory limit of PHP to the value. This works only if the function ini_set() is not disabled by your sysadmin. 'forceReturnPath' => FALSE, // Boolean: Force return path to be applied in mail() calls. If this is set, all calls to mail() done by t3lib_htmlmail will be called with '-f<return_path> as the 5th parameter. This will make the return path correct on almost all Unix systems. There is a known problem with Postfix below version 2: Mails are not sent if this option is set and Postfix is used. On Windows platforms, the return path is set via a call to ini_set. This has no effect if safe_mode in PHP is on. @@ -223,7 +223,7 @@ 'usePHPFileFunctions' => TRUE, // Boolean: If set, all fileoperations are done by the default PHP-functions. Default on Unix is using the system commands by exec(). You need to set this flag under safe_mode. 'compressionLevel' => 0, // Determines output compression of BE output. Makes output smaller but slows down the page generation depending on the compression level. Requires a) zlib in your PHP installation and b) special rewrite rules for .css.gzip and .js.gzip (please see misc/advanced.htacces for an example). Range 1-9, where 1 is least compression and 9 is greatest compression. 'true' as value will set the compression based on the PHP default settings (usually 5). Suggested and most optimal value is 5. 'maxFileSize' => '10240', // Integer: If set this is the max filesize in KB's for file operations in the backend. Can be overridden through $TCA per table field separately. - 'forceCharset' => '', // String: Normally the charset of the backend users language selection is used. If you set this value to a charset found in t3lib/csconvtbl/ (or "utf-8") the backend (and database) will ALWAYS use this charset. Always use a lowercase value. + 'forceCharset' => '-1', // String: Normally the charset of the backend users language selection is used. If you set this value to a charset found in t3lib/csconvtbl/ (or "utf-8") the backend (and database) will ALWAYS use this charset. Always use a lowercase value. NOTICE: This option is deprecated since TYPO3 4.5, and will be removed in 4.7. Please use proper tools to set your installation to UTF-8. 'installToolPassword' => '', // String: This is the md5-hashed password for the Install Tool. Set this to '' and access will be totally denied. PLEASE consider to externally password protect the typo3/install/ folder, eg. with a .htaccess file. 'defaultUserTSconfig' => 'options.enableBookmarks=1 options.enableShowPalettes=1 @@ -429,6 +429,63 @@ } require(PATH_typo3conf.'localconf.php'); + +/** + * checking for UTF-8 in the settings since TYPO3 4.5 + * + * since TYPO3 4.5, only UTF-8 is supported. The -1 operator is used to see if the option was set + * in the installations' localconf.php. + * + * [BE][forceCharset] is set to the charset that TYPO3 is using + * [SYS][setDBinit] is used to set the DB connection + * and both settings need to be set to UTF8 in order to work correctly + */ +if ($TYPO3_CONF_VARS['BE']['forceCharset'] == '-1') { + if (!t3lib_div::compat_version('4.5')) { + // upgrading system without having forceCharset set and + // run through the upgrade wizard + die('This installation was just upgraded to TYPO3 ' . TYPO3_branch . ' but does not run with UTF-8 natively.
+Please add the following line to typo3conf/localconf.php and afterwards use the corresponding Update Wizard in the TYPO3 Install Tool.
+
+$TYPO3_CONF_VARS[\'BE\'][\'forceCharset\'] = \'\';
+'); + } else { + // 1) no option was set in localconf.php but the upgrade wizard + // was already used, so the admin is knowing what he's doing, + // 2) a new installation with the new default value + $TYPO3_CONF_VARS['BE']['forceCharset'] = 'utf-8'; + } +} elseif ($TYPO3_CONF_VARS['BE']['forceCharset'] != 'utf-8') { + // the forceCharset option is set in localconf.php, but to something else + t3lib_div::deprecationLog('This TYPO3 installation is using ' . $TYPO3_CONF_VARS['BE']['forceCharset'] . ' as the charset. Only UTF-8 is supported since TYPO3 4.5. The DB, its connection and TYPO3 must be migrated to UTF-8.'); +} else { + // the forceCharset option is set to UTF-8, so in the end this option can be removed + // once the compat version was raised + t3lib_div::deprecationLog('The option $TYPO3_CONF_VARS[\'BE\'][\'forceCharset\'] is set, but is deprecated since TYPO3 4.5. Please remove the option from typo3conf/localconf.php.'); +} + +if ($TYPO3_CONF_VARS['SYS']['setDBinit'] == '-1') { + if (!t3lib_div::compat_version('4.5')) { + // upgrading system without having forceCharset set + // and run through the upgrade wizard + die('This installation was just upgraded to TYPO3 ' . TYPO3_branch . ' but does not run with UTF-8 natively.
+Please add the following line to typo3conf/localconf.php and afterwards use the corresponding Update Wizard in the TYPO3 Install Tool.
+
+$TYPO3_CONF_VARS[\'SYS\'][\'setDBinit\'] = \'\';
'); + } else { + // 1) no option was set in localconf.php but the upgrade wizard + // was already used, so the admin is knowing what he's doing, + // 2) a new installation with the new default value + $TYPO3_CONF_VARS['SYS']['setDBinit'] = 'SET NAMES utf8'; + } +} elseif (stripos($TYPO3_CONF_VARS['SYS']['setDBinit'], 'SET NAMES utf8') !== FALSE) { + t3lib_div::deprecationLog('This TYPO3 installation is using ' . $TYPO3_CONF_VARS['SYS']['setDBinit'] . ' as its character set. Only UTF-8 is supported since TYPO3 4.5. The DB, its connection and TYPO3 must be migrated to UTF-8.'); +} elseif ($TYPO3_CONF_VARS['SYS']['setDBinit'] != '') { + t3lib_div::deprecationLog('The option $TYPO3_CONF_VARS[\'SYS\'][\'setDBinit\'] is set, but should not be used anymore. Please check if this setting is establishing a UTF-8 DB connection, and remove the setting from typo3conf/localconf.php.'); +} + + + $timeZone = $GLOBALS['TYPO3_CONF_VARS']['phpTimeZone']; if (empty($timeZone)) { // time zone from the server environment (TZ env or OS query) Index: t3lib/class.t3lib_db.php =================================================================== --- t3lib/class.t3lib_db.php (Revision 9325) +++ t3lib/class.t3lib_db.php (Arbeitskopie) @@ -1414,6 +1414,25 @@ ); } } + + /** + * checks if the current connection uses utf8 + * setDBinit overrides variables + */ + public function connectionIsUtf8() { + $dbConnectionIsUtf8 = trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit'], ' ;') == 'SET NAMES utf8' ? TRUE : FALSE; + if (!$dbConnectionIsUtf8) { + $res = $GLOBALS['TYPO3_DB']->admin_query('SHOW VARIABLES LIKE "%character%"'); + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) { + if (preg_match('/character_set_(client|connection|results)/', $row[0]) && $row[1] != 'utf-8') { + $dbConnectionIsUtf8 = FALSE; + break; + } + } + } + return $dbConnectionIsUtf8; + } + /** * Checks if database is connected Index: typo3/sysext/install/mod/class.tx_install.php =================================================================== --- typo3/sysext/install/mod/class.tx_install.php (Revision 9325) +++ typo3/sysext/install/mod/class.tx_install.php (Arbeitskopie) @@ -143,6 +143,7 @@ require_once(t3lib_extMgm::extPath('install') . 'requirements.php'); // include update classes +require_once(t3lib_extMgm::extPath('install') . 'updates/class.tx_coreupdates_utf8db.php'); require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_compatversion.php'); require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_cscsplit.php'); require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_notinmenu.php'); @@ -3193,6 +3194,42 @@ database.

', 1, 1); + + // connection is UTF8, and TYPO3 is talking UTF8 + if ($GLOBALS['TYPO3_DB']->connectionIsUtf8() + && $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] == 'utf8') { + $this->message($ext, 'Database', ' +

The TYPO3 installation and the database connection + use UTF-8 as character set. Everything\'s perfect.

+ ', -1, 1); + } + + // connection isn't UTF8, but TYPO3 is talking UTF8 + if (!$GLOBALS['TYPO3_DB']->connectionIsUtf8() + && $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] == 'utf8') { + $this->message($ext, 'Database', ' +

You are in trouble.

+ ', 2, 1); + } + + // connection is UTF8, but TYPO3 isn't talking UTF8 + if ($GLOBALS['TYPO3_DB']->connectionIsUtf8() + && $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] != 'utf8') { + $this->message($ext, 'Database', ' +

TYPO3 isn\'t using UTF-8, but the database connection + uses UTF-8 as character set. This means that latin1 data + is in a UTF-8 database. Please consult help and update.

+ ', 2, 1); + } + + // connection isn't UTF8, AND TYPO3 isn't talking UTF8 + if (!$GLOBALS['TYPO3_DB']->connectionIsUtf8() + && $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] != 'utf8') { + $this->message($ext, 'Database', ' +

Update is straight FORWARD

+ ', 1, 1); + } + } } else { $sqlSafeModeUser = ''; @@ -3711,7 +3748,7 @@ $newdbname=trim($this->INSTALL['localconf.php']['NEW_DATABASE_NAME']); if (!preg_match('/[^[:alnum:]_-]/',$newdbname)) { if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) { - if ($GLOBALS['TYPO3_DB']->admin_query('CREATE DATABASE '.$newdbname)) { + if ($GLOBALS['TYPO3_DB']->admin_query('CREATE DATABASE ' . $newdbname . ' CHARACTER SET utf8')) { $this->INSTALL['localconf.php']['typo_db'] = $newdbname; $this->messages[]= "Database '".$newdbname."' created"; } else { @@ -3769,7 +3806,10 @@ break; case 'typo_db': if (strlen($value)<50) { - if (strcmp(TYPO3_db,$value)) $this->setValueInLocalconfFile($lines, '$typo_db', trim($value)); + if (strcmp(TYPO3_db, $value)) { + $this->setValueInLocalconfFile($lines, '$typo_db', trim($value)); + $GLOBALS['TYPO3_DB']->admin_query('ALTER DATABASE ' . trim($value) . ' CHARACTER SET utf8'); + } } else { $this->errorMessages[] = ' Database name \'' . $value . '\' was @@ -6452,12 +6492,27 @@ $tmpObj = $this->getUpgradeObjInstance($className, $identifier); if (method_exists($tmpObj,'checkForUpdate')) { $explanation = ''; - if ($tmpObj->checkForUpdate($explanation)) { + $showUpdate = NULL; + // return value kept for backwards compatibility + $returnVal = $tmpObj->checkForUpdate($explanation, &$showUpdate); + if ($showUpdate == NULL) { + $showUpdate = $returnVal; + } + if ($showUpdate > 0) { $updateMarkers = array( + 'next' => '', 'identifier' => $identifier, 'explanation' => $explanation, - 'next' => 'Next' ); + + // only display the message, no button + if ($showUpdate == 2) { + $updateMarkers['next'] = ''; + } + $singleUpdate[] = t3lib_parsehtml::substituteMarkerArray( $singleUpdateWizardBoxSubpart, $updateMarkers, Index: typo3/sysext/install/ext_localconf.php =================================================================== --- typo3/sysext/install/ext_localconf.php (Revision 9325) +++ typo3/sysext/install/ext_localconf.php (Arbeitskopie) @@ -1,6 +1,10 @@
  1. - + ###NEXT###