summaryrefslogtreecommitdiff
path: root/includes/filerepo
diff options
context:
space:
mode:
Diffstat (limited to 'includes/filerepo')
-rw-r--r--includes/filerepo/FileRepo.php6
-rw-r--r--includes/filerepo/ForeignAPIRepo.php5
2 files changed, 8 insertions, 3 deletions
diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php
index 5b42c2c6..cef1176d 100644
--- a/includes/filerepo/FileRepo.php
+++ b/includes/filerepo/FileRepo.php
@@ -431,7 +431,9 @@ class FileRepo {
# Now try an old version of the file
if ( $time !== false ) {
$img = $this->newFile( $title, $time );
- $img->load( $flags );
+ if ( $img ) {
+ $img->load( $flags );
+ }
if ( $img && $img->exists() ) {
if ( !$img->isDeleted( File::DELETED_FILE ) ) {
return $img; // always OK
@@ -452,10 +454,10 @@ class FileRepo {
$redir = $this->checkRedirect( $title );
if ( $redir && $title->getNamespace() == NS_FILE ) {
$img = $this->newFile( $redir );
- $img->load( $flags );
if ( !$img ) {
return false;
}
+ $img->load( $flags );
if ( $img->exists() ) {
$img->redirectedFrom( $title->getDBkey() );
diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php
index 3c031921..71d2b919 100644
--- a/includes/filerepo/ForeignAPIRepo.php
+++ b/includes/filerepo/ForeignAPIRepo.php
@@ -21,6 +21,8 @@
* @ingroup FileRepo
*/
+use MediaWiki\Logger\LoggerFactory;
+
/**
* A foreign repository with a remote MediaWiki with an API thingy
*
@@ -521,7 +523,8 @@ class ForeignAPIRepo extends FileRepo {
if ( $status->isOK() ) {
return $req->getContent();
} else {
- wfDebug( "ForeignAPIRepo: ERROR on GET: " . $status->getWikiText() );
+ $logger = LoggerFactory::getInstance( 'http' );
+ $logger->warning( $status->getWikiText(), array( 'caller' => 'ForeignAPIRepo::httpGet' ) );
return false;
}
}