Merge "mediawiki.util: Remove redundant file closures"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 7 Sep 2019 17:19:54 +0000 (17:19 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 7 Sep 2019 17:19:54 +0000 (17:19 +0000)
includes/api/ApiMain.php
includes/logging/LogPage.php
includes/specials/SpecialRecentChangesLinked.php
includes/specials/SpecialStatistics.php
maintenance/dumpUploads.php
maintenance/mergeMessageFileList.php

index a9fe258..f0e0077 100644 (file)
@@ -293,7 +293,6 @@ class ApiMain extends ApiBase {
                $this->mEnableWrite = $enableWrite;
 
                $this->mCdnMaxAge = -1; // flag for executeActionWithErrorHandling()
-               $this->mCommit = false;
        }
 
        /**
index 981aeb0..d5f5de3 100644 (file)
@@ -94,8 +94,7 @@ class LogPage {
 
                $dbw = wfGetDB( DB_MASTER );
 
-               // @todo FIXME private/protected/public property?
-               $this->timestamp = $now = wfTimestampNow();
+               $now = wfTimestampNow();
                $data = [
                        'log_type' => $this->type,
                        'log_action' => $this->action,
index 8865654..26f3665 100644 (file)
@@ -229,13 +229,7 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges {
                        $sql = $dbr->limitResult( $sql, $limit, false );
                }
 
-               $res = $dbr->query( $sql, __METHOD__ );
-
-               if ( $res->numRows() == 0 ) {
-                       $this->mResultEmpty = true;
-               }
-
-               return $res;
+               return $dbr->query( $sql, __METHOD__ );
        }
 
        function setTopText( FormOptions $opts ) {
index eff8889..83153ae 100644 (file)
@@ -47,7 +47,6 @@ class SpecialStatistics extends SpecialPage {
                $this->total = SiteStats::pages();
                $this->users = SiteStats::users();
                $this->activeUsers = SiteStats::activeUsers();
-               $this->hook = '';
 
                $text = Xml::openElement( 'table', [ 'class' => 'wikitable mw-statistics-table' ] );
 
index c4ca056..40cac1b 100644 (file)
@@ -32,6 +32,9 @@ require_once __DIR__ . '/Maintenance.php';
  * @ingroup Maintenance
  */
 class DumpUploads extends Maintenance {
+       /** @var string */
+       private $mBasePath;
+
        public function __construct() {
                parent::__construct();
                $this->addDescription( 'Generates list of uploaded files which can be fed to tar or similar.
@@ -44,30 +47,29 @@ By default, outputs relative paths against the parent directory of $wgUploadDire
 
        public function execute() {
                global $IP;
-               $this->mAction = 'fetchLocal';
                $this->mBasePath = $this->getOption( 'base', $IP );
-               $this->mShared = false;
-               $this->mSharedSupplement = false;
-
-               if ( $this->hasOption( 'local' ) ) {
-                       $this->mAction = 'fetchLocal';
-               }
-
-               if ( $this->hasOption( 'used' ) ) {
-                       $this->mAction = 'fetchUsed';
-               }
+               $shared = false;
+               $sharedSupplement = false;
 
                if ( $this->hasOption( 'shared' ) ) {
                        if ( $this->hasOption( 'used' ) ) {
                                // Include shared-repo files in the used check
-                               $this->mShared = true;
+                               $shared = true;
                        } else {
                                // Grab all local *plus* used shared
-                               $this->mSharedSupplement = true;
+                               $sharedSupplement = true;
                        }
                }
-               $this->{$this->mAction} ( $this->mShared );
-               if ( $this->mSharedSupplement ) {
+
+               if ( $this->hasOption( 'local' ) ) {
+                       $this->fetchLocal( $shared );
+               } elseif ( $this->hasOption( 'used' ) ) {
+                       $this->fetchUsed( $shared );
+               } else {
+                       $this->fetchLocal( $shared );
+               }
+
+               if ( $sharedSupplement ) {
                        $this->fetchUsed( true );
                }
        }
index 48a6666..d78c5a0 100644 (file)
@@ -129,7 +129,6 @@ class MergeMessageFileList extends Maintenance {
                $files = [];
                $fileLines = file( $fileName );
                if ( $fileLines === false ) {
-                       $this->hasError = true;
                        $this->error( "Unable to open list file $fileName." );
 
                        return $files;
@@ -144,7 +143,6 @@ class MergeMessageFileList extends Maintenance {
                                if ( file_exists( $extension ) ) {
                                        $files[] = $extension;
                                } else {
-                                       $this->hasError = true;
                                        $this->error( "Extension {$extension} doesn't exist" );
                                }
                        }