aboutsummaryrefslogtreecommitdiffstats
path: root/includes/filerepo
diff options
context:
space:
mode:
authorAaron Schulz <aschulz@wikimedia.org>2016-09-17 22:29:06 -0700
committerGergő Tisza <gtisza@wikimedia.org>2016-09-19 06:34:24 +0000
commit37ad84cb911a4cac1973dc96d54efbc31beb9aa2 (patch)
tree4e903452f1670fc7437201039067ec8fa2e435fa /includes/filerepo
parent25a1651aadad734c5124a52225c972b00e92de96 (diff)
downloadmediawikicore-37ad84cb911a4cac1973dc96d54efbc31beb9aa2.tar.gz
mediawikicore-37ad84cb911a4cac1973dc96d54efbc31beb9aa2.zip
Cleanups and IDEA warning fixes to FileRepo classes
Change-Id: I98247b299c31b93df183981adc517187cb4aefe5
Diffstat (limited to 'includes/filerepo')
-rw-r--r--includes/filerepo/FileRepo.php4
-rw-r--r--includes/filerepo/ForeignDBViaLBRepo.php3
-rw-r--r--includes/filerepo/file/ArchivedFile.php1
-rw-r--r--includes/filerepo/file/ForeignAPIFile.php8
-rw-r--r--includes/filerepo/file/LocalFile.php10
5 files changed, 16 insertions, 10 deletions
diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php
index b8b1cf6a17ad..8fee3bfa749d 100644
--- a/includes/filerepo/FileRepo.php
+++ b/includes/filerepo/FileRepo.php
@@ -825,7 +825,7 @@ class FileRepo {
$status = $this->storeBatch( [ [ $srcPath, $dstZone, $dstRel ] ], $flags );
if ( $status->successCount == 0 ) {
- $status->ok = false;
+ $status->setOK( false );
}
return $status;
@@ -1166,7 +1166,7 @@ class FileRepo {
$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 f8b1ed9f7964..55df1af03bcc 100644
--- a/includes/filerepo/ForeignDBViaLBRepo.php
+++ b/includes/filerepo/ForeignDBViaLBRepo.php
@@ -42,6 +42,9 @@ class ForeignDBViaLBRepo extends LocalRepo {
/** @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 d1e683ac7060..921e129c36f5 100644
--- a/includes/filerepo/file/ArchivedFile.php
+++ b/includes/filerepo/file/ArchivedFile.php
@@ -425,6 +425,7 @@ class ArchivedFile {
*/
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 f6752d8308ec..43b6855f825c 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 @@ class ForeignAPIFile extends File {
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 @@ class ForeignAPIFile extends File {
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 618272c0c9c3..f3980f3675d2 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -1480,8 +1480,10 @@ class LocalFile extends File {
);
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 @@ class LocalFileRestoreBatch {
// 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 @@ class LocalFileMoveBatch {
if ( !$statusDb->isGood() ) {
$destFile->unlock();
$this->file->unlock();
- $statusDb->ok = false;
+ $statusDb->setOK( false );
return $statusDb;
}
@@ -2971,7 +2973,7 @@ class LocalFileMoveBatch {
$this->file->unlock();
wfDebugLog( 'imagemove', "Error in moving files: "
. $statusMove->getWikiText( false, false, 'en' ) );
- $statusMove->ok = false;
+ $statusMove->setOK( false );
return $statusMove;
}