Small DB classes IDEA warning fixes and cleanups
authorAaron Schulz <aschulz@wikimedia.org>
Mon, 24 Oct 2016 05:03:37 +0000 (22:03 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 24 Oct 2016 05:03:37 +0000 (22:03 -0700)
Change-Id: I65b5f452a364b329bb671540f4115dbc4f40eebd

includes/libs/rdbms/database/DatabasePostgres.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 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" );