Merge "Special:NewFiles - ensure top text is entirely wrapped"
[lhc/web/wiklou.git] / includes / filerepo / ForeignAPIRepo.php
index 06b21a8..c20df76 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MediaWikiServices;
 
 /**
  * A foreign repository with a remote MediaWiki with an API thingy
@@ -74,7 +75,7 @@ class ForeignAPIRepo extends FileRepo {
                parent::__construct( $info );
 
                // https://commons.wikimedia.org/w/api.php
-               $this->mApiBase = isset( $info['apibase'] ) ? $info['apibase'] : null;
+               $this->mApiBase = $info['apibase'] ?? null;
 
                if ( isset( $info['apiThumbCacheExpiry'] ) ) {
                        $this->apiThumbCacheExpiry = $info['apiThumbCacheExpiry'];
@@ -332,7 +333,7 @@ class ForeignAPIRepo extends FileRepo {
         * @return bool|string
         */
        function getThumbUrlFromCache( $name, $width, $height, $params = "" ) {
-               $cache = ObjectCache::getMainWANInstance();
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
                // We can't check the local cache using FileRepo functions because
                // we override fileExistsBatch(). We have to use the FileBackend directly.
                $backend = $this->getBackend(); // convenience
@@ -569,7 +570,7 @@ class ForeignAPIRepo extends FileRepo {
                        $url = $this->makeUrl( $query, 'api' );
                }
 
-               $cache = ObjectCache::getMainWANInstance();
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
                return $cache->getWithSetCallback(
                        $this->getLocalCacheKey( static::class, $target, md5( $url ) ),
                        $cacheTTL,