Yaron Koren has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/284699

Change subject: Use MyISAM for tables with a Searchtext field
......................................................................

Use MyISAM for tables with a Searchtext field

Change-Id: Ic51dc1e870354fa2ce34e1b5707a0f0d7479e7b3
---
M CargoUtils.php
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cargo 
refs/changes/99/284699/1

diff --git a/CargoUtils.php b/CargoUtils.php
index 44381fe..d689191 100644
--- a/CargoUtils.php
+++ b/CargoUtils.php
@@ -518,6 +518,8 @@
        }
 
        public static function createCargoTableOrTables( $cdb, $dbw, 
$tableName, $tableSchema, $tableSchemaString, $templatePageID ) {
+               global $wgCargoDBtype;
+
                // Unfortunately, there is not yet a 'CREATE TABLE' wrapper
                // in the MediaWiki DB API, so we have to call SQL directly.
                $dbType = $cdb->getType();
@@ -532,6 +534,7 @@
                        $cdb->addIdentifierQuotes( '_pageNamespace' ) . " 
$intTypeString NOT NULL, " .
                        $cdb->addIdentifierQuotes( '_pageID' ) . " 
$intTypeString NOT NULL";
 
+               $containsSearchTextType = false;
                foreach ( $tableSchema->mFieldDescriptions as $fieldName => 
$fieldDescription ) {
                        $size = $fieldDescription->mSize;
                        $isList = $fieldDescription->mIsList;
@@ -563,10 +566,17 @@
                                $createSQL .= $integerTypeString;
                        } elseif ( $fieldType == 'Searchtext' ) {
                                $createSQL .= ", FULLTEXT KEY $fieldName (" . 
$cdb->addIdentifierQuotes( $fieldName ) . ')';
+                               $containsSearchTextType = true;
                        }
                }
                $createSQL .= ' )';
 
+               // For MySQL 5.6 and earlier, only MyISAM supports 'FULLTEXT'
+               // indexes; InnoDB does not.
+               if ( $containsSearchTextType && $wgCargoDBtype == 'mysql' ) {
+                       $createSQL .= ' ENGINE=MyISAM';
+               }
+
                //$cdb->ignoreErrors( true );
                $cdb->query( $createSQL );
                //$cdb->ignoreErrors( false );

-- 
To view, visit https://gerrit.wikimedia.org/r/284699
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic51dc1e870354fa2ce34e1b5707a0f0d7479e7b3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to