Allow the empty string as the wiki DB
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 6 Nov 2014 19:38:22 +0000 (11:38 -0800)
committerOri.livneh <ori@wikimedia.org>
Thu, 6 Nov 2014 23:40:24 +0000 (23:40 +0000)
* This is useful when cluster= is set but the DB is not there yet

Change-Id: I1766c564448502c7359c7da964f0becd2e3222c6

maintenance/sql.php

index afa3ef7..886e3f1 100644 (file)
@@ -39,7 +39,8 @@ class MwSql extends Maintenance {
        }
 
        public function execute() {
-               $wiki = $this->getOption( 'wikidb' ) ?: false;
+               // We wan't to allow "" for the wikidb, meaning don't call select_db()
+               $wiki = $this->hasOption( 'wikidb' ) ? $this->getOption( 'wikidb' ) : false;
                // Get the appropriate load balancer (for this wiki)
                if ( $this->hasOption( 'cluster' ) ) {
                        $lb = wfGetLBFactory()->getExternalLB( $this->getOption( 'cluster' ), $wiki );