Merge "Swapping defaultbranch for track"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 25 Oct 2016 00:46:45 +0000 (00:46 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 25 Oct 2016 00:46:45 +0000 (00:46 +0000)
includes/libs/rdbms/database/DatabasePostgres.php
includes/libs/rdbms/lbfactory/ILBFactory.php
includes/libs/rdbms/lbfactory/LBFactory.php
includes/libs/rdbms/lbfactory/LBFactoryMulti.php
includes/libs/rdbms/lbfactory/LBFactorySimple.php
includes/libs/rdbms/lbfactory/LBFactorySingle.php
includes/objectcache/ObjectCache.php
maintenance/Maintenance.php
maintenance/update.php

index 016b9cd..7acd8dc 100644 (file)
@@ -1087,7 +1087,7 @@ __INDEXATTR__;
                if ( !is_array( $types ) ) {
                        $types = [ $types ];
                }
-               if ( !$schema ) {
+               if ( $schema === false ) {
                        $schema = $this->getCoreSchema();
                }
                $table = $this->realTableName( $table, 'raw' );
@@ -1236,7 +1236,6 @@ SQL;
 
        function strencode( $s ) {
                // Should not be called by us
-
                return pg_escape_string( $this->getBindingHandle(), $s );
        }
 
index 9c9f18d..ff1bd43 100644 (file)
@@ -86,28 +86,25 @@ interface ILBFactory {
 
        /**
         * Create a new load balancer for external storage. The resulting object will be
-        * untracked, not chronology-protected, and the caller is responsible for
-        * cleaning it up.
+        * untracked, not chronology-protected, and the caller is responsible for cleaning it up.
         *
         * This method is for only advanced usage and callers should almost always use
         * getExternalLB() instead. This method can be useful when a table is used as a
         * key/value store. In that cases, one might want to query it in autocommit mode
         * (DBO_TRX off) but still use DBO_TRX transaction rounds on other tables.
         *
-        * @param string $cluster External storage cluster, or false for core
-        * @param bool|string $domain Domain ID, or false for the current domain
+        * @param string $cluster External storage cluster name
         * @return ILoadBalancer
         */
-       public function newExternalLB( $cluster, $domain = false );
+       public function newExternalLB( $cluster );
 
        /**
         * Get a cached (tracked) load balancer for external storage
         *
-        * @param string $cluster External storage cluster, or false for core
-        * @param bool|string $domain Domain ID, or false for the current domain
+        * @param string $cluster External storage cluster name
         * @return ILoadBalancer
         */
-       public function getExternalLB( $cluster, $domain = false );
+       public function getExternalLB( $cluster );
 
        /**
         * Execute a function for each tracked load balancer
index f3a3275..d21289b 100644 (file)
@@ -153,18 +153,16 @@ abstract class LBFactory implements ILBFactory {
        /**
         * @see ILBFactory::newExternalLB()
         * @param string $cluster
-        * @param bool $domain
         * @return LoadBalancer
         */
-       abstract public function newExternalLB( $cluster, $domain = false );
+       abstract public function newExternalLB( $cluster );
 
        /**
         * @see ILBFactory::getExternalLB()
         * @param string $cluster
-        * @param bool $domain
         * @return LoadBalancer
         */
-       abstract public function getExternalLB( $cluster, $domain = false );
+       abstract public function getExternalLB( $cluster );
 
        /**
         * Call a method of each tracked load balancer
index 83ca650..a7cc16c 100644 (file)
@@ -255,13 +255,7 @@ class LBFactoryMulti extends LBFactory {
                return $this->mainLBs[$section];
        }
 
-       /**
-        * @param string $cluster
-        * @param DatabaseDomain|string|bool $domain Domain ID, or false for the current domain
-        * @throws InvalidArgumentException
-        * @return LoadBalancer
-        */
-       public function newExternalLB( $cluster, $domain = false ) {
+       public function newExternalLB( $cluster ) {
                if ( !isset( $this->externalLoads[$cluster] ) ) {
                        throw new InvalidArgumentException( __METHOD__ . ": Unknown cluster \"$cluster\"" );
                }
@@ -281,14 +275,9 @@ class LBFactoryMulti extends LBFactory {
                );
        }
 
-       /**
-        * @param string $cluster External storage cluster, or false for core
-        * @param DatabaseDomain|string|bool $domain Domain ID, or false for the current domain
-        * @return LoadBalancer
-        */
-       public function getExternalLB( $cluster, $domain = false ) {
+       public function getExternalLB( $cluster ) {
                if ( !isset( $this->extLBs[$cluster] ) ) {
-                       $this->extLBs[$cluster] = $this->newExternalLB( $cluster, $domain );
+                       $this->extLBs[$cluster] = $this->newExternalLB( $cluster );
                        $this->getChronologyProtector()->initLB( $this->extLBs[$cluster] );
                }
 
index 674bafd..1e69d8f 100644 (file)
@@ -91,13 +91,7 @@ class LBFactorySimple extends LBFactory {
                return $this->mainLB;
        }
 
-       /**
-        * @param string $cluster
-        * @param bool|string $domain
-        * @return LoadBalancer
-        * @throws InvalidArgumentException
-        */
-       public function newExternalLB( $cluster, $domain = false ) {
+       public function newExternalLB( $cluster ) {
                if ( !isset( $this->externalClusters[$cluster] ) ) {
                        throw new InvalidArgumentException( __METHOD__ . ": Unknown cluster \"$cluster\"." );
                }
@@ -105,14 +99,9 @@ class LBFactorySimple extends LBFactory {
                return $this->newLoadBalancer( $this->externalClusters[$cluster] );
        }
 
-       /**
-        * @param string $cluster
-        * @param bool|string $domain
-        * @return LoadBalancer
-        */
-       public function getExternalLB( $cluster, $domain = false ) {
+       public function getExternalLB( $cluster ) {
                if ( !isset( $this->extLBs[$cluster] ) ) {
-                       $this->extLBs[$cluster] = $this->newExternalLB( $cluster, $domain );
+                       $this->extLBs[$cluster] = $this->newExternalLB( $cluster );
                        $this->getChronologyProtector()->initLB( $this->extLBs[$cluster] );
                }
 
index a64117f..e116888 100644 (file)
@@ -55,36 +55,34 @@ class LBFactorySingle extends LBFactory {
        }
 
        /**
-        * @param bool|string $wiki
+        * @param bool|string $domain (unused)
         * @return LoadBalancerSingle
         */
-       public function newMainLB( $wiki = false ) {
+       public function newMainLB( $domain = false ) {
                return $this->lb;
        }
 
        /**
-        * @param bool|string $wiki
+        * @param bool|string $domain (unused)
         * @return LoadBalancerSingle
         */
-       public function getMainLB( $wiki = false ) {
+       public function getMainLB( $domain = false ) {
                return $this->lb;
        }
 
        /**
-        * @param string $cluster External storage cluster, or false for core
-        * @param bool|string $wiki Wiki ID, or false for the current wiki
+        * @param string $cluster External storage cluster name (unused)
         * @return LoadBalancerSingle
         */
-       public function newExternalLB( $cluster, $wiki = false ) {
+       public function newExternalLB( $cluster ) {
                return $this->lb;
        }
 
        /**
-        * @param string $cluster External storage cluster, or false for core
-        * @param bool|string $wiki Wiki ID, or false for the current wiki
+        * @param string $cluster External storage cluster name (unused)
         * @return LoadBalancerSingle
         */
-       public function getExternalLB( $cluster, $wiki = false ) {
+       public function getExternalLB( $cluster ) {
                return $this->lb;
        }
 
index 53a474b..0a4f0ed 100644 (file)
@@ -326,9 +326,9 @@ class ObjectCache {
         * @throws UnexpectedValueException
         */
        public static function newWANCacheFromParams( array $params ) {
+               $erGroup = MediaWikiServices::getInstance()->getEventRelayerGroup();
                foreach ( $params['channels'] as $action => $channel ) {
-                       $params['relayers'][$action] = MediaWikiServices::getInstance()->getEventRelayerGroup()
-                               ->getRelayer( $channel );
+                       $params['relayers'][$action] = $erGroup->getRelayer( $channel );
                        $params['channels'][$action] = $channel;
                }
                $params['cache'] = self::newFromParams( $params['store'] );
index 1cb5eef..208cf17 100644 (file)
@@ -104,7 +104,7 @@ abstract class Maintenance {
 
        /**
         * Used by getDB() / setDB()
-        * @var IDatabase
+        * @var Database
         */
        private $mDb = null;
 
@@ -726,6 +726,7 @@ abstract class Maintenance {
 
                if ( is_array( $wgProfiler ) && isset( $wgProfiler['class'] ) ) {
                        $class = $wgProfiler['class'];
+                       /** @var Profiler $profiler */
                        $profiler = new $class(
                                [ 'sampling' => 1, 'output' => [ $output ] ]
                                        + $wgProfiler
@@ -1182,6 +1183,7 @@ abstract class Maintenance {
                $this->beginTransaction( $dbw, __METHOD__ );
 
                # Get "active" text records from the revisions table
+               $cur = [];
                $this->output( 'Searching for active text records in revisions table...' );
                $res = $dbw->select( 'revision', 'rev_text_id', [], __METHOD__, [ 'DISTINCT' ] );
                foreach ( $res as $row ) {
index b96e7eb..a672e29 100755 (executable)
@@ -145,6 +145,7 @@ class UpdateMediaWiki extends Maintenance {
 
                $this->output( "Going to run database updates for " . wfWikiID() . "\n" );
                if ( $db->getType() === 'sqlite' ) {
+                       /** @var Database|DatabaseSqlite $db */
                        $this->output( "Using SQLite file: '{$db->getDbFilePath()}'\n" );
                }
                $this->output( "Depending on the size of your database this may take a while!\n" );