X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilerepo%2Ffile%2FFile.php;h=6a788b627f42764a10b5714464f5a21e3b88f1c7;hb=73e42ae08b8f0b0c8137cbdf4b4bd420b76ecdbc;hp=546b78a0b5f544e3c3256c33cd074bd750c12eab;hpb=f7d107e3a35f624d6f4caeac488e3c4681fbed7b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 546b78a0b5..6a788b627f 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -590,14 +590,14 @@ abstract class File implements IDBAccessObject { */ public function getMatchedLanguage( $userPreferredLanguage ) { $handler = $this->getHandler(); - if ( $handler && method_exists( $handler, 'getMatchedLanguage' ) ) { + if ( $handler ) { return $handler->getMatchedLanguage( $userPreferredLanguage, $handler->getAvailableLanguages( $this ) ); - } else { - return null; } + + return null; } /** @@ -2051,34 +2051,34 @@ abstract class File implements IDBAccessObject { /** * Get the HTML text of the description page, if available * - * @param bool|Language $lang Optional language to fetch description in + * @param Language|null $lang Optional language to fetch description in * @return string|false */ - function getDescriptionText( $lang = false ) { + function getDescriptionText( Language $lang = null ) { global $wgLang; if ( !$this->repo || !$this->repo->fetchDescription ) { return false; } - $lang = $lang ?: $wgLang; + $lang = $lang ?? $wgLang; $renderUrl = $this->repo->getDescriptionRenderUrl( $this->getName(), $lang->getCode() ); if ( $renderUrl ) { $cache = MediaWikiServices::getInstance()->getMainWANObjectCache(); $key = $this->repo->getLocalCacheKey( 'RemoteFileDescription', - 'url', $lang->getCode(), - $this->getName() + md5( $this->getName() ) ); + $fname = __METHOD__; return $cache->getWithSetCallback( $key, $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE, - function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl ) { + function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl, $fname ) { wfDebug( "Fetching shared description from $renderUrl\n" ); - $res = Http::get( $renderUrl, [], __METHOD__ ); + $res = Http::get( $renderUrl, [], $fname ); if ( !$res ) { $ttl = WANObjectCache::TTL_UNCACHEABLE; }