X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryStashImageInfo.php;h=1924ca0339a86092329fb0a2e05b29274e12d73b;hb=24ae4318b36f88f2dd43db5989074b65776e2cf8;hp=b039a1ec45d93d18932ada3765ecdd635527d3a2;hpb=fc1ca75323b5f424a9f8d28d42d85a311ed2f721;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryStashImageInfo.php b/includes/api/ApiQueryStashImageInfo.php index b039a1ec45..1924ca0339 100644 --- a/includes/api/ApiQueryStashImageInfo.php +++ b/includes/api/ApiQueryStashImageInfo.php @@ -33,7 +33,7 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { public function execute() { if ( !$this->getUser()->isLoggedIn() ) { - $this->dieUsage( 'You must be logged-in to have an upload stash', 'notloggedin' ); + $this->dieWithError( 'apierror-mustbeloggedin-uploadstash', 'notloggedin' ); } $params = $this->extractRequestParams(); @@ -45,9 +45,7 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { $result = $this->getResult(); - if ( !$params['filekey'] && !$params['sessionkey'] ) { - $this->dieUsage( 'One of filekey or sessionkey must be supplied', 'nofilekey' ); - } + $this->requireAtLeastOneParameter( $params, 'filekey', 'sessionkey' ); // Alias sessionkey to filekey, but give an existing filekey precedence. if ( !$params['filekey'] && $params['sessionkey'] ) { @@ -66,9 +64,9 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { } // @todo Update exception handling here to understand current getFile exceptions } catch ( UploadStashFileNotFoundException $e ) { - $this->dieUsage( 'File not found: ' . $e->getMessage(), 'invalidsessiondata' ); + $this->dieWithException( $e, [ 'wrap' => 'apierror-stashedfilenotfound' ] ); } catch ( UploadStashBadPathException $e ) { - $this->dieUsage( 'Bad path: ' . $e->getMessage(), 'invalidsessiondata' ); + $this->dieWithException( $e, [ 'wrap' => 'apierror-stashpathinvalid' ] ); } } @@ -125,6 +123,6 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { } public function getHelpUrls() { - return 'https://www.mediawiki.org/wiki/API:Stashimageinfo'; + return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Stashimageinfo'; } }