jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/312650 )
Change subject: SpecialRunJobs: Use wfHttpError to generate error messages
..
SpecialRunJobs: Use wfHttpError to generate error messages
wfHttpError generates HTML so the content fits to the Content-Type.
Bug: T146546
Change-Id: Ia90f22564ecb3807aff3b787242bc74fe1678def
---
M includes/specials/SpecialRunJobs.php
1 file changed, 6 insertions(+), 10 deletions(-)
Approvals:
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/specials/SpecialRunJobs.php
b/includes/specials/SpecialRunJobs.php
index e1e2049..761610e 100644
--- a/includes/specials/SpecialRunJobs.php
+++ b/includes/specials/SpecialRunJobs.php
@@ -41,14 +41,10 @@
public function execute( $par = '' ) {
$this->getOutput()->disable();
if ( wfReadOnly() ) {
- // HTTP 423 Locked
- HttpStatus::header( 423 );
- print 'Wiki is in read-only mode';
-
+ wfHttpError( 423, 'Locked', 'Wiki is in read-only
mode.' );
return;
} elseif ( !$this->getRequest()->wasPosted() ) {
- HttpStatus::header( 400 );
- print 'Request must be POSTed';
+ wfHttpError( 400, 'Bad Request', 'Request must be
POSTed.' );
return;
}
@@ -58,8 +54,9 @@
$params = array_intersect_key(
$this->getRequest()->getValues(), $required + $optional );
$missing = array_diff_key( $required, $params );
if ( count( $missing ) ) {
- HttpStatus::header( 400 );
- print 'Missing parameters: ' . implode( ', ',
array_keys( $missing ) );
+ wfHttpError( 400, 'Bad Request',
+ 'Missing parameters: ' . implode( ', ',
array_keys( $missing ) )
+ );
return;
}
@@ -71,8 +68,7 @@
$verified = is_string( $providedSignature )
&& hash_equals( $correctSignature, $providedSignature );
if ( !$verified || $params['sigexpiry'] < time() ) {
- HttpStatus::header( 400 );
- print 'Invalid or stale signature provided';
+ wfHttpError( 400, 'Bad Request', 'Invalid or stale
signature provided.' );
return;
}
--
To view, visit https://gerrit.wikimedia.org/r/312650
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia90f22564ecb3807aff3b787242bc74fe1678def
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Fomafix
Gerrit-Reviewer: Florianschmidtwelzow
Gerrit-Reviewer: Legoktm
Gerrit-Reviewer: jenkins-bot <>
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits