dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove ugly function existence check
[lhc/web/wiklou.git]
/
includes
/
filerepo
/
file
/
File.php
diff --git
a/includes/filerepo/file/File.php
b/includes/filerepo/file/File.php
index
370ebb4
..
6a788b6
100644
(file)
--- 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();
*/
public function getMatchedLanguage( $userPreferredLanguage ) {
$handler = $this->getHandler();
- if ( $handler
&& method_exists( $handler, 'getMatchedLanguage' )
) {
+ if ( $handler ) {
return $handler->getMatchedLanguage(
$userPreferredLanguage,
$handler->getAvailableLanguages( $this )
);
return $handler->getMatchedLanguage(
$userPreferredLanguage,
$handler->getAvailableLanguages( $this )
);
- } else {
- return null;
}
}
+
+ return null;
}
/**
}
/**
@@
-2051,17
+2051,17
@@
abstract class File implements IDBAccessObject {
/**
* Get the HTML text of the description page, if available
*
/**
* 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
*/
* @return string|false
*/
- function getDescriptionText(
$lang = false
) {
+ function getDescriptionText(
Language $lang = null
) {
global $wgLang;
if ( !$this->repo || !$this->repo->fetchDescription ) {
return false;
}
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 ) {
$renderUrl = $this->repo->getDescriptionRenderUrl( $this->getName(), $lang->getCode() );
if ( $renderUrl ) {
@@
-2071,13
+2071,14
@@
abstract class File implements IDBAccessObject {
$lang->getCode(),
md5( $this->getName() )
);
$lang->getCode(),
md5( $this->getName() )
);
+ $fname = __METHOD__;
return $cache->getWithSetCallback(
$key,
$this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
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" );
wfDebug( "Fetching shared description from $renderUrl\n" );
- $res = Http::get( $renderUrl, [],
__METHOD__
);
+ $res = Http::get( $renderUrl, [],
$fname
);
if ( !$res ) {
$ttl = WANObjectCache::TTL_UNCACHEABLE;
}
if ( !$res ) {
$ttl = WANObjectCache::TTL_UNCACHEABLE;
}