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;
}
$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;
}
$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;
}