* @file
*/
+use MediaWiki\MediaWikiServices;
+
/**
* A query action to get image information and upload history.
*
if ( isset( $params['badfilecontexttitle'] ) ) {
$badFileContextTitle = Title::newFromText( $params['badfilecontexttitle'] );
if ( !$badFileContextTitle ) {
- $this->dieUsage( 'Invalid title in badfilecontexttitle parameter', 'invalid-title' );
+ $p = $this->getModulePrefix();
+ $this->dieWithError( [ 'apierror-bad-badfilecontexttitle', $p ], 'invalid-title' );
}
} else {
$badFileContextTitle = false;
$paramList = $h->parseParamString( $otherParams );
if ( !$paramList ) {
- // Just set a warning (instead of dieUsage), as in many cases
+ // Just set a warning (instead of dieWithError), as in many cases
// we could still render the image using width and height parameters,
// and this type of thing could happen between different versions of
// handlers.
* @return array Result array
*/
public static function getInfo( $file, $prop, $result, $thumbParams = null, $opts = false ) {
- global $wgContLang;
-
$anyHidden = false;
if ( !$opts || is_string( $opts ) ) {
$opts = [
'version' => $opts ?: 'latest',
- 'language' => $wgContLang,
+ 'language' => MediaWikiServices::getInstance()->getContentLanguage(),
'multilang' => false,
'extmetadatafilter' => [],
'revdelUser' => null,
}
public function getAllowedParams() {
- global $wgContLang;
-
return [
'prop' => [
ApiBase::PARAM_ISMULTI => true,
],
'extmetadatalanguage' => [
ApiBase::PARAM_TYPE => 'string',
- ApiBase::PARAM_DFLT => $wgContLang->getCode(),
+ ApiBase::PARAM_DFLT =>
+ MediaWikiServices::getInstance()->getContentLanguage()->getCode(),
],
'extmetadatamultilang' => [
ApiBase::PARAM_TYPE => 'boolean',