X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=blobdiff_plain;f=includes%2FTitle.php;h=2021e0ab9c0bb1a01f28c61fe7950eb28fc3f051;hb=b675be2083;hp=8aa8cb7db79b5a81c0801fdd5f8511d8d7966d5e;hpb=3e433dd09d5f65edc281c140fcd9a4cc056d1d16;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Title.php b/includes/Title.php index 8aa8cb7db7..2021e0ab9c 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -500,7 +500,7 @@ class Title implements LinkTarget { * @param string $interwiki The interwiki prefix * @return Title The new object */ - public static function &makeTitle( $ns, $title, $fragment = '', $interwiki = '' ) { + public static function makeTitle( $ns, $title, $fragment = '', $interwiki = '' ) { $t = new Title(); $t->mInterwiki = $interwiki; $t->mFragment = $fragment; @@ -2271,13 +2271,17 @@ class Title implements LinkTarget { * @return array List of errors */ private function checkUserBlock( $action, $user, $errors, $rigor, $short ) { + global $wgEmailConfirmToEdit, $wgBlockDisablesLogin; // Account creation blocks handled at userlogin. // Unblocking handled in SpecialUnblock if ( $rigor === 'quick' || in_array( $action, [ 'createaccount', 'unblock' ] ) ) { return $errors; } - global $wgEmailConfirmToEdit; + // Optimize for a very common case + if ( $action === 'read' && !$wgBlockDisablesLogin ) { + return $errors; + } if ( $wgEmailConfirmToEdit && !$user->isEmailConfirmed() ) { $errors[] = [ 'confirmedittext' ]; @@ -2319,8 +2323,8 @@ class Title implements LinkTarget { # If the user is allowed to read pages, he is allowed to read all pages $whitelisted = true; } elseif ( $this->isSpecial( 'Userlogin' ) - || $this->isSpecial( 'ChangePassword' ) || $this->isSpecial( 'PasswordReset' ) + || $this->isSpecial( 'Userlogout' ) ) { # Always grant access to the login page. # Even anons need to be able to log in. @@ -2434,6 +2438,7 @@ class Title implements LinkTarget { $checks = [ 'checkPermissionHooks', 'checkReadPermissions', + 'checkUserBlock', // for wgBlockDisablesLogin ]; # Don't call checkSpecialsAndNSPermissions or checkCSSandJSPermissions # here as it will lead to duplicate error messages. This is okay to do