Perform cheaper checks first

Change-Id: I54808896efdd302558f11b7d6ec6d01622657b92
This commit is contained in:
Siebrand Mazeland 2016-03-07 15:21:34 +01:00 committed by Hashar
parent ae1779b0e0
commit c935dff562

View file

@ -232,7 +232,7 @@ class SpecialInterwiki extends SpecialPage {
// (Bug 30599).
global $wgLegalTitleChars;
$validPrefixChars = preg_replace( '/[ :&=]/', '', $wgLegalTitleChars );
if ( preg_match( "/\s|[^$validPrefixChars]/", $prefix ) && $do === 'add' ) {
if ( $do === 'add' && preg_match( "/\s|[^$validPrefixChars]/", $prefix ) ) {
$this->error( 'interwiki-badprefix', htmlspecialchars( $prefix ) );
$this->showForm( $do );
return;