From 415b4059b929f9609fa5f62d68224a01127901b7 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 14 Sep 2009 21:42:28 +0000 Subject: [PATCH] Merge live hack from wmf-deployment r53208: skip calculation of display names for groups in permission errors when we're only checking for a yes/no --- includes/Title.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index 5abc368a33..adab8d4ace 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1009,7 +1009,8 @@ class Title { /** * Can $wgUser perform $action on this page? - * This skips potentially expensive cascading permission checks. + * This skips potentially expensive cascading permission checks + * as well as avoids expensive error formatting * * Suitable for use for nonessential UI controls in common cases, but * _not_ for functional access control. @@ -1208,8 +1209,14 @@ class Title { } } elseif( !$user->isAllowed( $action ) ) { $return = null; - $groups = array_map( array( 'User', 'makeGroupLinkWiki' ), - User::getGroupsWithPermission( $action ) ); + + // We avoid expensive display logic for quickUserCan's and such + $groups = false; + if (!$short) { + $groups = array_map( array( 'User', 'makeGroupLinkWiki' ), + User::getGroupsWithPermission( $action ) ); + } + if( $groups ) { $return = array( 'badaccess-groups', array( implode( ', ', $groups ), count( $groups ) ) ); -- 2.20.1