r105763 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105762‎ | r105763 | r105764 >
Date:15:44, 10 December 2011
Author:ialex
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -1522,7 +1522,7 @@
15231523 */
15241524 private function checkActionPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) {
15251525 if ( $action == 'protect' ) {
1526 - if ( $this->getUserPermissionsErrors( 'edit', $user ) != array() ) {
 1526+ if ( count( $this->getUserPermissionsErrorsInternal( 'edit', $user, $doExpensiveQueries, true ) ) ) {
15271527 // If they can't edit, they shouldn't protect.
15281528 $errors[] = array( 'protect-cantedit' );
15291529 }

Status & tagging log