From d1635b45cc77ef10c1459c0537ecffe353b8ad06 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 10 Dec 2011 15:44:44 +0000 Subject: [PATCH] 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. --- includes/Title.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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' ); } -- 2.20.1