jenkins-bot has submitted this change and it was merged.

Change subject: Cleanups and IDEA warning fixes to FileRepo classes
......................................................................


Cleanups and IDEA warning fixes to FileRepo classes

Change-Id: I98247b299c31b93df183981adc517187cb4aefe5
---
M includes/filerepo/FileRepo.php
M includes/filerepo/ForeignDBViaLBRepo.php
M includes/filerepo/file/ArchivedFile.php
M includes/filerepo/file/ForeignAPIFile.php
M includes/filerepo/file/LocalFile.php
5 files changed, 16 insertions(+), 10 deletions(-)

Approvals:
  Gergő Tisza: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php
index b8b1cf6..8fee3bf 100644
--- a/includes/filerepo/FileRepo.php
+++ b/includes/filerepo/FileRepo.php
@@ -825,7 +825,7 @@
 
                $status = $this->storeBatch( [ [ $srcPath, $dstZone, $dstRel ] 
], $flags );
                if ( $status->successCount == 0 ) {
-                       $status->ok = false;
+                       $status->setOK( false );
                }
 
                return $status;
@@ -1166,7 +1166,7 @@
                $status = $this->publishBatch(
                        [ [ $src, $dstRel, $archiveRel, $options ] ], $flags );
                if ( $status->successCount == 0 ) {
-                       $status->ok = false;
+                       $status->setOK( false );
                }
                if ( isset( $status->value[0] ) ) {
                        $status->value = $status->value[0];
diff --git a/includes/filerepo/ForeignDBViaLBRepo.php 
b/includes/filerepo/ForeignDBViaLBRepo.php
index f8b1ed9..55df1af 100644
--- a/includes/filerepo/ForeignDBViaLBRepo.php
+++ b/includes/filerepo/ForeignDBViaLBRepo.php
@@ -42,6 +42,9 @@
        /** @var array */
        protected $fileFromRowFactory = [ 'ForeignDBFile', 'newFromRow' ];
 
+       /** @var bool */
+       protected $hasSharedCache;
+
        /**
         * @param array|null $info
         */
diff --git a/includes/filerepo/file/ArchivedFile.php 
b/includes/filerepo/file/ArchivedFile.php
index d1e683a..921e129 100644
--- a/includes/filerepo/file/ArchivedFile.php
+++ b/includes/filerepo/file/ArchivedFile.php
@@ -425,6 +425,7 @@
         */
        function pageCount() {
                if ( !isset( $this->pageCount ) ) {
+                       // @FIXME: callers expect File objects
                        if ( $this->getHandler() && 
$this->handler->isMultiPage( $this ) ) {
                                $this->pageCount = $this->handler->pageCount( 
$this );
                        } else {
diff --git a/includes/filerepo/file/ForeignAPIFile.php 
b/includes/filerepo/file/ForeignAPIFile.php
index f6752d8..43b6855 100644
--- a/includes/filerepo/file/ForeignAPIFile.php
+++ b/includes/filerepo/file/ForeignAPIFile.php
@@ -28,7 +28,10 @@
  * @ingroup FileAbstraction
  */
 class ForeignAPIFile extends File {
+       /** @var bool */
        private $mExists;
+       /** @var array */
+       private $mInfo = [];
 
        protected $repoClass = 'ForeignApiRepo';
 
@@ -244,7 +247,7 @@
        public function getUser( $type = 'text' ) {
                if ( $type == 'text' ) {
                        return isset( $this->mInfo['user'] ) ? strval( 
$this->mInfo['user'] ) : null;
-               } elseif ( $type == 'id' ) {
+               } else {
                        return 0; // What makes sense here, for a remote user?
                }
        }
@@ -344,9 +347,6 @@
                return $files;
        }
 
-       /**
-        * @see File::purgeCache()
-        */
        function purgeCache( $options = [] ) {
                $this->purgeThumbnails( $options );
                $this->purgeDescriptionPage();
diff --git a/includes/filerepo/file/LocalFile.php 
b/includes/filerepo/file/LocalFile.php
index 618272c..f3980f3 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -1480,8 +1480,10 @@
                                                );
 
                                                if ( isset( 
$status->value['revision'] ) ) {
+                                                       /** @var $rev Revision 
*/
+                                                       $rev = 
$status->value['revision'];
                                                        // Associate new page 
revision id
-                                                       
$logEntry->setAssociatedRevId( $status->value['revision']->getId() );
+                                                       
$logEntry->setAssociatedRevId( $rev->getId() );
                                                }
                                                // This relies on the 
resetArticleID() call in WikiPage::insertOn(),
                                                // which is triggered on 
$descTitle by doEditContent() above.
@@ -2692,7 +2694,7 @@
                                // Even if some files could be copied, fail 
entirely as that is the
                                // easiest thing to do without data loss
                                $this->cleanupFailedBatch( $storeStatus, 
$storeBatch );
-                               $status->ok = false;
+                               $status->setOk( false );
                                $this->file->unlock();
 
                                return $status;
@@ -2952,7 +2954,7 @@
                if ( !$statusDb->isGood() ) {
                        $destFile->unlock();
                        $this->file->unlock();
-                       $statusDb->ok = false;
+                       $statusDb->setOK( false );
 
                        return $statusDb;
                }
@@ -2971,7 +2973,7 @@
                                $this->file->unlock();
                                wfDebugLog( 'imagemove', "Error in moving 
files: "
                                        . $statusMove->getWikiText( false, 
false, 'en' ) );
-                               $statusMove->ok = false;
+                               $statusMove->setOK( false );
 
                                return $statusMove;
                        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I98247b299c31b93df183981adc517187cb4aefe5
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to