* Improvements to Install Tool:
authorMichael Stucki <michael.stucki@typo3.org>
Mon, 3 Mar 2008 16:15:20 +0000 (16:15 +0000)
committerMichael Stucki <michael.stucki@typo3.org>
Mon, 3 Mar 2008 16:15:20 +0000 (16:15 +0000)
  - Fixed bug #7589: FULLTEXT keys are not processed correctly

git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3364 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_install.php

index e6c8b7e..fb7ddbf 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,7 @@
        * Fixed bug #7729: Login screen needs to be XCLASSable
        * Improvements to Install Tool:
                - Cleanup in t3lib_install
+               - Fixed bug #7589: FULLTEXT keys are not processed correctly
        * Fix DB field types for static_tsconfig_help
 
 2008-03-03  Ingo Renner  <ingo@typo3.org>
index ec7953d..578d261 100755 (executable)
@@ -319,32 +319,36 @@ class t3lib_install {
                                } else {
                                        $lineV = preg_replace('/,$/','',$value);        // Strip trailing commas
                                        $lineV = str_replace('`', '', $lineV);
+                                       $lineV = str_replace('  ', ' ', $lineV);        // Remove double blanks
 
-                                       $lineV = str_replace('UNIQUE KEY', 'UNIQUE', $lineV);
                                        $parts = explode(' ', $lineV, 2);
+                                       if (!preg_match('/(PRIMARY|UNIQUE|FULLTEXT|INDEX|KEY)/',$parts[0])) {   // Field definition
 
-                                               // Make sure there is no default value when auto_increment is set
-                                       if(stristr($parts[1],'auto_increment')) {
-                                               $parts[1] = preg_replace('/ default \'0\'/i','',$parts[1]);
-                                       }
-                                               // "default" is always lower-case
-                                       if (stristr($parts[1], ' DEFAULT '))    {
-                                               $parts[1] = str_ireplace(' DEFAULT ', ' default ', $parts[1]);
-                                       }
-
-                                               // Change order of "default" and "null" statements
-                                       $parts[1] = preg_replace('/(.*) (default .*) (NOT NULL)/', '$1 $3 $2', $parts[1]);
-                                       $parts[1] = preg_replace('/(.*) (default .*) (NULL)/', '$1 $3 $2', $parts[1]);
+                                                       // Make sure there is no default value when auto_increment is set
+                                               if (stristr($parts[1],'auto_increment')) {
+                                                       $parts[1] = preg_replace('/ default \'0\'/i','',$parts[1]);
+                                               }
+                                                       // "default" is always lower-case
+                                               if (stristr($parts[1], ' DEFAULT '))    {
+                                                       $parts[1] = str_ireplace(' DEFAULT ', ' default ', $parts[1]);
+                                               }
 
-                                               // Remove double blanks
-                                       $parts[1] = str_replace('  ', ' ', $parts[1]);
+                                                       // Change order of "default" and "null" statements
+                                               $parts[1] = preg_replace('/(.*) (default .*) (NOT NULL)/', '$1 $3 $2', $parts[1]);
+                                               $parts[1] = preg_replace('/(.*) (default .*) (NULL)/', '$1 $3 $2', $parts[1]);
 
-                                       if ($parts[0]!='PRIMARY' && $parts[0]!='KEY' && $parts[0]!='UNIQUE')    {
-                                                       // Field definition
                                                $key = $parts[0];
                                                $total[$table]['fields'][$key] = $parts[1];
-                                       } else {
-                                                       // Key definition
+
+                                       } else {        // Key definition
+                                               $search = array('/UNIQUE (INDEX|KEY)/', '/FULLTEXT (INDEX|KEY)/', '/INDEX/');
+                                               $replace = array('UNIQUE', 'FULLTEXT', 'KEY');
+                                               $lineV = preg_replace($search, $replace, $lineV);
+
+                                               if (preg_match('/PRIMARY|UNIQUE|FULLTEXT/', $parts[0])) {
+                                                       $parts[1] = preg_replace('/^(KEY|INDEX) /', '', $parts[1]);
+                                               }
+
                                                $newParts = explode(' ',$parts[1],2);
                                                $key = $parts[0]=='PRIMARY' ? $parts[0] : $newParts[0];
                                                $total[$table]['keys'][$key] = $lineV;
@@ -460,7 +464,9 @@ class t3lib_install {
                                if ($keyName=='PRIMARY') {
                                        $prefix = 'PRIMARY KEY';
                                } else {
-                                       if ($keyRow['Non_unique']) {
+                                       if ($keyRow['Index_type']=='FULLTEXT') {
+                                               $prefix = 'FULLTEXT';
+                                       } elseif ($keyRow['Non_unique']) {
                                                $prefix = 'KEY';
                                        } else {
                                                $prefix = 'UNIQUE';