[TASK] Remove last bit of multiplyDBfieldSize handling 81/21581/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Fri, 21 Jun 2013 20:33:05 +0000 (22:33 +0200)
committerMarkus Klein <klein.t3@mfc-linz.at>
Fri, 21 Jun 2013 21:13:58 +0000 (23:13 +0200)
multiplyDBfieldSize was used in the past to extend the size of
database fields to cope with UTF8 content if the database did
not support it. The setting was deprecated for a long time already
and removed from DefaultConfiguration with version 6.0.
The patch removes still existing handler code from ext:install.
The setting is also removed from LocalConfiguration if found.

Change-Id: Ia36b8c05cab8814c91ffa0d8e8afcd4de5c7060b
Resolves: #49334
Related: #35923
Related: #49299
Releases: 6.2
Reviewed-on: https://review.typo3.org/21581
Reviewed-by: Philipp Gampe
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/install/Classes/Controller/StepController.php
typo3/sysext/install/Classes/Service/SqlSchemaMigrationService.php

index ad33539..971a457 100644 (file)
@@ -81,8 +81,8 @@ class StepController extends AbstractController {
                'SYS/caching/cacheFrontends',
                // #38414
                'SYS/extCache',
-               // @TODO: #35923 - Still referenced in SqlSchemaMigrationService
-               //'SYS/multiplyDBfieldSize',
+               // #35923
+               'SYS/multiplyDBfieldSize',
                // #46993
                'SYS/T3instID',
        );
index a03546d..5080394 100644 (file)
@@ -43,27 +43,12 @@ class SqlSchemaMigrationService {
         */
        protected $deletedPrefixKey = 'zzz_deleted_';
 
-       // Prefix used for tables/fields when deleted/renamed.
-       /**
-        * @var float|int Multiplier of SQL field size (for char, varchar and text fields)
-        */
-       protected $multiplySize = 1;
-
        /**
         * @var array Caching output of $GLOBALS['TYPO3_DB']->admin_get_charsets()
         */
        protected $character_sets = array();
 
        /**
-        * Constructor function
-        */
-       public function __construct() {
-               if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['multiplyDBfieldSize'] >= 1 && $GLOBALS['TYPO3_CONF_VARS']['SYS']['multiplyDBfieldSize'] <= 5) {
-                       $this->multiplySize = (double) $GLOBALS['TYPO3_CONF_VARS']['SYS']['multiplyDBfieldSize'];
-               }
-       }
-
-       /**
         * Set prefix of deleted tables
         *
         * @param string $prefix Prefix string
@@ -169,77 +154,10 @@ class SqlSchemaMigrationService {
                                }
                        }
                }
-               $this->getFieldDefinitions_sqlContent_parseTypes($total);
                return $total;
        }
 
        /**
-        * Multiplies varchars/tinytext fields in size according to $this->multiplySize
-        * Useful if you want to use UTF-8 in the database and needs to extend the field sizes in the database so UTF-8 chars are not discarded. For most charsets available as single byte sets, multiplication with 2 should be enough. For chinese, use 3.
-        *
-        * @param array $total Total array (from getFieldDefinitions_fileContent())
-        * @return void
-        * @access private
-        * @see getFieldDefinitions_fileContent()
-        */
-       protected function getFieldDefinitions_sqlContent_parseTypes(&$total) {
-               $mSize = (double) $this->multiplySize;
-               if ($mSize > 1) {
-                       /** @var $sqlParser \TYPO3\CMS\Core\Database\SqlParser */
-                       $sqlParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\SqlParser');
-                       foreach ($total as $table => $cfg) {
-                               if (is_array($cfg['fields'])) {
-                                       foreach ($cfg['fields'] as $fN => $fType) {
-                                               $orig_fType = $fType;
-                                               $fInfo = $sqlParser->parseFieldDef($fType);
-                                               switch ($fInfo['fieldType']) {
-                                               case 'char':
-
-                                               case 'varchar':
-                                                       $newSize = round($fInfo['value'] * $mSize);
-                                                       if ($newSize <= 255) {
-                                                               $fInfo['value'] = $newSize;
-                                                       } else {
-                                                               $fInfo = array(
-                                                                       'fieldType' => 'text',
-                                                                       'featureIndex' => array(
-                                                                               'NOTNULL' => array(
-                                                                                       'keyword' => 'NOT NULL'
-                                                                               )
-                                                                       )
-                                                               );
-                                                               // Change key definition if necessary (must use "prefix" on TEXT columns)
-                                                               if (is_array($cfg['keys'])) {
-                                                                       foreach ($cfg['keys'] as $kN => $kType) {
-                                                                               $match = array();
-                                                                               preg_match('/^([^(]*)\\(([^)]+)\\)(.*)/', $kType, $match);
-                                                                               $keys = array();
-                                                                               foreach (\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $match[2]) as $kfN) {
-                                                                                       if ($fN == $kfN) {
-                                                                                               $kfN .= '(' . $newSize . ')';
-                                                                                       }
-                                                                                       $keys[] = $kfN;
-                                                                               }
-                                                                               $total[$table]['keys'][$kN] = $match[1] . '(' . implode(',', $keys) . ')' . $match[3];
-                                                                       }
-                                                               }
-                                                       }
-                                                       break;
-                                               case 'tinytext':
-                                                       $fInfo['fieldType'] = 'text';
-                                                       break;
-                                               }
-                                               $total[$table]['fields'][$fN] = $sqlParser->compileFieldCfg($fInfo);
-                                               if ($sqlParser->parse_error) {
-                                                       throw new \RuntimeException('TYPO3 Fatal Error: ' . $sqlParser->parse_error, 1270853961);
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-
-       /**
         * Look up the default collation for specified character set based on "SHOW CHARACTER SET" output
         *
         * @param string $charset Character set