From a2fb4fd2dcef7658a42351d2094f5dc464dd7feb Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Mon, 18 Jul 2016 18:44:50 -0400 Subject: [PATCH] Revert "Make $wgBlockDisablesLogin also restrict logged in permissions" Replacing with a better version of this patch This reverts commit e9b706f4552b183a7c45b48328e5a2ce06251f72. --- includes/Block.php | 37 +++++++++++++------------------------ includes/Title.php | 8 +------- 2 files changed, 14 insertions(+), 31 deletions(-) diff --git a/includes/Block.php b/includes/Block.php index a62593b..93df004 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -961,39 +961,28 @@ class Block { /** * Get/set whether the Block prevents a given action - * - * @param string $action Action to check - * @param bool|null $x Value for set, or null to just get value - * @return bool|null Null for unrecognized rights. + * @param string $action + * @param bool|null $x + * @return bool */ public function prevents( $action, $x = null ) { - global $wgBlockDisablesLogin; - $res = null; switch ( $action ) { case 'edit': # For now... - $res = true; - break; + return true; + case 'createaccount': - $res = wfSetVar( $this->mCreateAccount, $x ); - break; + return wfSetVar( $this->mCreateAccount, $x ); + case 'sendemail': - $res = wfSetVar( $this->mBlockEmail, $x ); - break; + return wfSetVar( $this->mBlockEmail, $x ); + case 'editownusertalk': - $res = wfSetVar( $this->mDisableUsertalk, $x ); - break; - case 'read': - $res = false; - break; - } - if ( !$res && $wgBlockDisablesLogin ) { - // If a block would disable login, then it should - // prevent any action that all users cannot do - $res = User::isEveryoneAllowed( $action ) ? $res : true; - } + return wfSetVar( $this->mDisableUsertalk, $x ); - return $res; + default: + return null; + } } /** diff --git a/includes/Title.php b/includes/Title.php index 75ee84e..3dd37d7 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2270,18 +2270,13 @@ 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; } - // Optimize for a very common case - if ( $action === 'read' && !$wgBlockDisablesLogin ) { - return $errors; - } - + global $wgEmailConfirmToEdit; if ( $wgEmailConfirmToEdit && !$user->isEmailConfirmed() ) { $errors[] = [ 'confirmedittext' ]; @@ -2438,7 +2433,6 @@ 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 -- 2.0.1