From: Alexandre Emsenhuber Date: Sat, 10 Dec 2011 15:44:44 +0000 (+0000) Subject: Do the "user is allowed to edit" check when checking for protect rights with the... X-Git-Tag: 1.31.0-rc.0~26101 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/modifier.php?a=commitdiff_plain;h=d1635b45cc77ef10c1459c0537ecffe353b8ad06;p=lhc%2Fweb%2Fwiklou.git Do the "user is allowed to edit" check when checking for protect rights with the same level of expensiveness as for the protect checks and also do "quick" checks since we don't care about the message names. This avoids a DB query for cascading protection on each page view for users with protect right. --- diff --git a/includes/Title.php b/includes/Title.php index b7360ebabc..28589c7a6e 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1522,7 +1522,7 @@ class Title { */ private function checkActionPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) { if ( $action == 'protect' ) { - if ( $this->getUserPermissionsErrors( 'edit', $user ) != array() ) { + if ( count( $this->getUserPermissionsErrorsInternal( 'edit', $user, $doExpensiveQueries, true ) ) ) { // If they can't edit, they shouldn't protect. $errors[] = array( 'protect-cantedit' ); }