X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fapi%2FApiQueryImageInfo.php;h=0bbfad3a836b680dbccd92d7ab79e34b281115c7;hb=8642482ee1618aa867e119bd34e5928398590608;hp=d1fcfa3f07c9c24095544645fe57d7c71c962575;hpb=61898ad28ed69c5b391eb43e0db9386279b9612c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index d1fcfa3f07..0bbfad3a83 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -280,8 +280,7 @@ class ApiQueryImageInfo extends ApiQueryBase { $h = $image->getHandler(); if ( !$h ) { - $this->setWarning( 'Could not create thumbnail because ' . - $image->getName() . ' does not have an associated image handler' ); + $this->addWarning( [ 'apiwarn-nothumb-noimagehandler', wfEscapeWikiText( $image->getName() ) ] ); return $thumbParams; } @@ -292,23 +291,24 @@ class ApiQueryImageInfo extends ApiQueryBase { // we could still render the image using width and height parameters, // and this type of thing could happen between different versions of // handlers. - $this->setWarning( "Could not parse {$p}urlparam for " . $image->getName() - . '. Using only width and height' ); + $this->addWarning( [ 'apiwarn-badurlparam', $p, wfEscapeWikiText( $image->getName() ) ] ); $this->checkParameterNormalise( $image, $thumbParams ); return $thumbParams; } if ( isset( $paramList['width'] ) && isset( $thumbParams['width'] ) ) { if ( intval( $paramList['width'] ) != intval( $thumbParams['width'] ) ) { - $this->setWarning( "Ignoring width value set in {$p}urlparam ({$paramList['width']}) " - . "in favor of width value derived from {$p}urlwidth/{$p}urlheight " - . "({$thumbParams['width']})" ); + $this->addWarning( + [ 'apiwarn-urlparamwidth', $p, $paramList['width'], $thumbParams['width'] ] + ); } } foreach ( $paramList as $name => $value ) { if ( !$h->validateParam( $name, $value ) ) { - $this->dieUsage( "Invalid value for {$p}urlparam ($name=$value)", 'urlparam' ); + $this->dieWithError( + [ 'apierror-invalidurlparam', $p, wfEscapeWikiText( $name ), wfEscapeWikiText( $value ) ] + ); } } @@ -337,8 +337,7 @@ class ApiQueryImageInfo extends ApiQueryBase { // in the actual normalised version, only if we can actually normalise them, // so we use the functions scope to throw away the normalisations. if ( !$h->normaliseParams( $image, $finalParams ) ) { - $this->dieUsage( 'Could not normalise image parameters for ' . - $image->getName(), 'urlparamnormal' ); + $this->dieWithError( [ 'apierror-urlparamnormal', wfEscapeWikiText( $image->getName() ) ] ); } }