Use WebRequest::getRawVal instead of WebRequest::getText

The UTF-8 normalization for the URL attributes `action` and `namespace`
are not needed.

Also use === instead of ==.

Change-Id: I03a844d58b11f45dc67f3dfb861d8f6e9ffcc18d
This commit is contained in:
Fomafix 2022-08-30 08:40:10 +00:00
parent b124456dff
commit cfc33f1a2a

View file

@ -72,13 +72,13 @@ class SpecialNuke extends SpecialPage {
$reason = $this->getDeleteReason( $this->getRequest(), $target ); $reason = $this->getDeleteReason( $this->getRequest(), $target );
$limit = $req->getInt( 'limit', 500 ); $limit = $req->getInt( 'limit', 500 );
$namespace = $req->getVal( 'namespace' ); $namespace = $req->getRawVal( 'namespace' );
$namespace = ctype_digit( $namespace ) ? (int)$namespace : null; $namespace = ctype_digit( $namespace ) ? (int)$namespace : null;
if ( $req->wasPosted() if ( $req->wasPosted()
&& $currentUser->matchEditToken( $req->getVal( 'wpEditToken' ) ) && $currentUser->matchEditToken( $req->getVal( 'wpEditToken' ) )
) { ) {
if ( $req->getVal( 'action' ) === 'delete' ) { if ( $req->getRawVal( 'action' ) === 'delete' ) {
$pages = $req->getArray( 'pages' ); $pages = $req->getArray( 'pages' );
if ( $pages ) { if ( $pages ) {
@ -86,7 +86,7 @@ class SpecialNuke extends SpecialPage {
return; return;
} }
} elseif ( $req->getVal( 'action' ) === 'submit' ) { } elseif ( $req->getRawVal( 'action' ) === 'submit' ) {
$this->listForm( $target, $reason, $limit, $namespace ); $this->listForm( $target, $reason, $limit, $namespace );
} else { } else {
$this->promptForm(); $this->promptForm();
@ -429,7 +429,7 @@ class SpecialNuke extends SpecialPage {
$status = 'job'; $status = 'job';
} }
if ( $status == 'job' ) { if ( $status === 'job' ) {
$res[] = $this->msg( 'nuke-deletion-queued' ) $res[] = $this->msg( 'nuke-deletion-queued' )
->plaintextParams( $title->getPrefixedText() ) ->plaintextParams( $title->getPrefixedText() )
->parse(); ->parse();