Aaron Schulz has submitted this change and it was merged.

Change subject: Add input callback for tables.sql to prevent indexes being 
created on the search index table.
......................................................................


Add input callback for tables.sql to prevent indexes being created
on the search index table.

Removes need for live hack for tables.sql in
https://gerrit.wikimedia.org/r/#/c/22466

> var_dump( strpos( 'CREATE UNIQUE INDEX /*i*/si_page ON /*_*/searchindex 
> (si_page);', 'ON /*_*/searchindex' ) === false );
bool(false)

Change-Id: I9863978354cd50c18191671b08db158ed55f68c6
---
M addWiki.php
1 file changed, 18 insertions(+), 1 deletion(-)

Approvals:
  Aaron Schulz: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/addWiki.php b/addWiki.php
index 1378d73..a1cb6d8 100644
--- a/addWiki.php
+++ b/addWiki.php
@@ -46,6 +46,17 @@
                return Maintenance::DB_ADMIN;
        }
 
+       /**
+        * Used as an override from SQL commands in tables.sql being executed.
+        * In this cases, index creations on the searchindex table
+        *
+        * @param $cmd string
+        * @return bool
+        */
+       public function noExecuteCommands( $cmd ) {
+               return strpos( $cmd, 'ON /*_*/searchindex' ) === false;
+       }
+
        public function execute() {
                global $IP, $wgDefaultExternalStore, $wmfVersionNumber;
                if ( !$wmfVersionNumber ) { // set in CommonSettings.php
@@ -74,7 +85,13 @@
                $dbw->selectDB( $dbName );
 
                $this->output( "Initialising tables\n" );
-               $dbw->sourceFile( $this->getDir() . '/tables.sql' );
+               $dbw->sourceFile(
+                       $this->getDir() . '/tables.sql',
+                       false,
+                       false,
+                       __METHOD__,
+                       array( $this, 'noExecuteCommands' )
+               );
                $dbw->sourceFile( "$IP/extensions/OAI/update_table.sql" );
                $dbw->sourceFile( 
"$IP/extensions/AntiSpoof/sql/patch-antispoof.mysql.sql" );
                $dbw->sourceFile( "$IP/extensions/CheckUser/cu_changes.sql" );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9863978354cd50c18191671b08db158ed55f68c6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaMaintenance
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to