Merge "RevisionStoreDbTestBase, remove redundant needsDB override"
[lhc/web/wiklou.git] / includes / filerepo / file / ForeignAPIFile.php
index 1002b82..fd3dc8b 100644 (file)
@@ -128,8 +128,8 @@ class ForeignAPIFile extends File {
                // Note, the this->canRender() check above implies
                // that we have a handler, and it can do makeParamString.
                $otherParams = $this->handler->makeParamString( $params );
-               $width = isset( $params['width'] ) ? $params['width'] : -1;
-               $height = isset( $params['height'] ) ? $params['height'] : -1;
+               $width = $params['width'] ?? -1;
+               $height = $params['height'] ?? -1;
 
                $thumbUrl = $this->repo->getThumbUrlFromCache(
                        $this->getName(),
@@ -311,9 +311,7 @@ class ForeignAPIFile extends File {
         * @return bool|string
         */
        function getDescriptionUrl() {
-               return isset( $this->mInfo['descriptionurl'] )
-                       ? $this->mInfo['descriptionurl']
-                       : false;
+               return $this->mInfo['descriptionurl'] ?? false;
        }
 
        /**
@@ -357,12 +355,12 @@ class ForeignAPIFile extends File {
        }
 
        function purgeDescriptionPage() {
-               global $wgContLang;
-
-               $url = $this->repo->getDescriptionRenderUrl( $this->getName(), $wgContLang->getCode() );
+               $services = MediaWikiServices::getInstance();
+               $url = $this->repo->getDescriptionRenderUrl(
+                       $this->getName(), $services->getContentLanguage()->getCode() );
                $key = $this->repo->getLocalCacheKey( 'RemoteFileDescription', 'url', md5( $url ) );
 
-               MediaWikiServices::getInstance()->getMainWANObjectCache()->delete( $key );
+               $services->getMainWANObjectCache()->delete( $key );
        }
 
        /**