* @return string
*/
function fetchImageQuery( $query ) {
- global $wgMemc;
+ global $wgMemc, $wgLanguageCode;
$query = array_merge( $query,
array(
'action' => 'query',
'redirects' => 'true'
) );
+ if ( !isset( $query['uselang'] ) ) { // uselang is unset or null
+ $query['uselang'] = $wgLanguageCode;
+ }
if ( $this->mApiBase ) {
$url = wfAppendQuery( $this->mApiBase, $query );
} else {
}
}
+ /**
+ * @param $name string
+ * @param $width int
+ * @param $height int
+ * @param $otherParams string
+ * @return bool|MediaTransformError
+ * @since 1.22
+ */
+ function getThumbError( $name, $width = -1, $height = -1, $otherParams = '', $lang = null ) {
+ $data = $this->fetchImageQuery( array(
+ 'titles' => 'File:' . $name,
+ 'iiprop' => 'url|timestamp',
+ 'iiurlwidth' => $width,
+ 'iiurlheight' => $height,
+ 'iiurlparam' => $otherParams,
+ 'prop' => 'imageinfo',
+ 'uselang' => $lang,
+ ) );
+ $info = $this->getImageInfo( $data );
+
+ if( $data && $info && isset( $info['thumberror'] ) ) {
+ wfDebug( __METHOD__ . " got remote thumb error " . $info['thumberror'] . "\n" );
+ return new MediaTransformError(
+ 'thumbnail_error_remote',
+ $width,
+ $height,
+ $this->getDisplayName(),
+ $info['thumberror'] // already parsed message from foreign repo
+ );
+ } else {
+ return false;
+ }
+ }
+
/**
* Return the imageurl from cache if possible
*