* (bug 13040) Gender switch in user preferences
* (bug 13040) {{GENDER:}} magic word for interface messages
* (bug 3301) Optionally sort user list according to account creation time
+* Remote description pages for foreign file repos are now fetched in the
+ content language.
=== Bug fixes in 1.15 ===
* (bug 16968) Special:Upload no longer throws useless warnings.
* Get the HTML text of the description page, if available
*/
function getDescriptionText() {
- global $wgMemc;
+ global $wgMemc, $wgLang;
if ( !$this->repo->fetchDescription ) {
return false;
}
- $renderUrl = $this->repo->getDescriptionRenderUrl( $this->getName() );
+ $renderUrl = $this->repo->getDescriptionRenderUrl( $this->getName(), $wgContLang->getCode() );
if ( $renderUrl ) {
if ( $this->repo->descriptionCacheExpiry > 0 ) {
wfDebug("Attempting to get the description from cache...");
- $key = wfMemcKey( 'RemoteFileDescription', 'url', md5($renderUrl) );
+ $key = wfMemcKey( 'RemoteFileDescription', 'url', $wgContLang->getCode(),
+ $this->getName() );
$obj = $wgMemc->get($key);
if ($obj) {
wfDebug("success!\n");
}
wfDebug( "Fetching shared description from $renderUrl\n" );
$res = Http::get( $renderUrl );
- if ( $res && $this->repo->descriptionCacheExpiry > 0 ) $wgMemc->set( $key, $res, $this->repo->descriptionCacheExpiry );
+ if ( $res && $this->repo->descriptionCacheExpiry > 0 ) {
+ $wgMemc->set( $key, $res, $this->repo->descriptionCacheExpiry );
+ }
return $res;
} else {
return false;
* MediaWiki this means action=render. This should only be called by the
* repository's file class, since it may return invalid results. User code
* should use File::getDescriptionText().
+ * @param string $name Name of image to fetch
+ * @param string $lang Language to fetch it in, if any.
*/
- function getDescriptionRenderUrl( $name ) {
+ function getDescriptionRenderUrl( $name, $lang = null ) {
+ $query = 'action=render';
+ if ( !is_null( $lang ) ) {
+ $query .= '&uselang=' . $lang;
+ }
if ( isset( $this->scriptDirUrl ) ) {
return $this->scriptDirUrl . '/index.php?title=' .
wfUrlencode( 'Image:' . $name ) .
- '&action=render';
+ "&$query";
} else {
$descUrl = $this->getDescriptionUrl( $name );
if ( $descUrl ) {
- return wfAppendQuery( $descUrl, 'action=render' );
+ return wfAppendQuery( $descUrl, $query );
} else {
return false;
}
}
function purgeDescriptionPage() {
- global $wgMemc;
- $url = $this->repo->getDescriptionRenderUrl( $this->getName() );
+ global $wgMemc, $wgContLang;
+ $url = $this->repo->getDescriptionRenderUrl( $this->getName(), $wgContLang->getCode() );
$key = wfMemcKey( 'RemoteFileDescription', 'url', md5($url) );
$wgMemc->delete( $key );
}