Log errors in Http::request()
[lhc/web/wiklou.git] / includes / filerepo / ForeignAPIRepo.php
index 7ead968..4ffbf4a 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup FileRepo
  */
 
+use MediaWiki\Logger\LoggerFactory;
+
 /**
  * A foreign repository with a remote MediaWiki with an API thingy
  *
@@ -29,7 +31,7 @@
  * $wgForeignFileRepos[] = array(
  *   'class'                  => 'ForeignAPIRepo',
  *   'name'                   => 'shared',
- *   'apibase'                => 'http://en.wikipedia.org/w/api.php',
+ *   'apibase'                => 'https://en.wikipedia.org/w/api.php',
  *   'fetchDescription'       => true, // Optional
  *   'descriptionCacheExpiry' => 3600,
  * );
@@ -72,7 +74,7 @@ class ForeignAPIRepo extends FileRepo {
                global $wgLocalFileRepo;
                parent::__construct( $info );
 
-               // http://commons.wikimedia.org/w/api.php
+               // https://commons.wikimedia.org/w/api.php
                $this->mApiBase = isset( $info['apibase'] ) ? $info['apibase'] : null;
 
                if ( isset( $info['apiThumbCacheExpiry'] ) ) {
@@ -521,6 +523,8 @@ class ForeignAPIRepo extends FileRepo {
                if ( $status->isOK() ) {
                        return $req->getContent();
                } else {
+                       $logger = LoggerFactory::getInstance( 'http' );
+                       $logger->warning( $status->getWikiText(), array( 'caller' => 'ForeignAPIRepo::httpGet' ) );
                        return false;
                }
        }