Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311367

Change subject: Avoid direct StatusValue->ok calls in File classes
......................................................................

Avoid direct StatusValue->ok calls in File classes

Also fixed a few other small IDEA warnings.

Change-Id: I463885a9f425491cd040cb1cdbc4c16925522848
---
M includes/filerepo/FileRepo.php
M includes/filerepo/RepoGroup.php
M includes/filerepo/file/ForeignAPIFile.php
M includes/filerepo/file/LocalFile.php
4 files changed, 7 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/67/311367/1

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/RepoGroup.php b/includes/filerepo/RepoGroup.php
index d515b05..bd32de04 100644
--- a/includes/filerepo/RepoGroup.php
+++ b/includes/filerepo/RepoGroup.php
@@ -135,17 +135,18 @@
                }
 
                # Check the cache
+               $dbkey = $title->getDBkey();
                if ( empty( $options['ignoreRedirect'] )
                        && empty( $options['private'] )
                        && empty( $options['bypassCache'] )
                ) {
                        $time = isset( $options['time'] ) ? $options['time'] : 
'';
-                       $dbkey = $title->getDBkey();
                        if ( $this->cache->has( $dbkey, $time, 60 ) ) {
                                return $this->cache->get( $dbkey, $time );
                        }
                        $useCache = true;
                } else {
+                       $time = false;
                        $useCache = false;
                }
 
diff --git a/includes/filerepo/file/ForeignAPIFile.php 
b/includes/filerepo/file/ForeignAPIFile.php
index f6752d8..5c3d643 100644
--- a/includes/filerepo/file/ForeignAPIFile.php
+++ b/includes/filerepo/file/ForeignAPIFile.php
@@ -344,9 +344,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..210aa7a 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -2692,7 +2692,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 +2952,7 @@
                if ( !$statusDb->isGood() ) {
                        $destFile->unlock();
                        $this->file->unlock();
-                       $statusDb->ok = false;
+                       $statusDb->setOK( false );
 
                        return $statusDb;
                }
@@ -2971,7 +2971,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/311367
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I463885a9f425491cd040cb1cdbc4c16925522848
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

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

Reply via email to