r48989 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48988‎ | r48989 | r48990 >
Date:11:02, 29 March 2009
Author:midom
Status:ok
Tags:
Comment:
fix some of RC rollback madness:
* Avoid extensive permission checks, just rely on User::isAllowed("rollback")
* Preload page_latest data in initial RC query, no need to run thousands of queries afterwards
Modified paths:
  • /trunk/phase3/includes/ChangesList.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRecentchanges.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ChangesList.php
@@ -331,8 +331,7 @@
332332 $page = $rc->getTitle();
333333 /** Check for rollback and edit permissions, disallow special pages, and only
334334 * show a link on the top-most revision */
335 - if( $page->quickUserCan('rollback') && $page->quickUserCan('edit')
336 - && $page->getLatestRevID() == $rc->mAttribs['rc_this_oldid'] )
 335+ if ($wgUser->isAllowed('rollback') && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid'] )
337336 {
338337 $rev = new Revision( array(
339338 'id' => $rc->mAttribs['rc_this_oldid'],
Index: trunk/phase3/includes/specials/SpecialRecentchanges.php
@@ -285,7 +285,10 @@
286286 $join_conds['watchlist'] = array('LEFT JOIN',
287287 "wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace");
288288 }
289 -
 289+ if ($wgUser->isAllowed("rollback")) {
 290+ $tables[] = 'page';
 291+ $join_conds['page'] = array('LEFT JOIN', 'rc_namespace=page_namespace AND rc_title=page_title AND rc_this_oldid=page_latest');
 292+ }
290293 // Tag stuff.
291294 $fields = array(); // Fields are * in this case, so let the function modify an empty array to keep it happy.
292295 ChangeTags::modifyDisplayQuery( $tables, $fields, $conds, $join_conds, $opts['tagfilter'] );

Follow-up revisions

RevisionCommit summaryAuthorDate
r50100Backported r48989, r48992: fix performance regression in Special:RecentChange...tstarling06:59, 1 May 2009
r50164Reverted r48983: obsolete since r48989, replaced by less intrusive optimisati...tstarling08:57, 4 May 2009
r50167Backport r49002, prevents watchlist breakage in conjunction with already-back...tstarling09:29, 4 May 2009

Status & tagging log