From: Domas Mituzas Date: Sun, 29 Mar 2009 11:02:16 +0000 (+0000) Subject: fix some of RC rollback madness: X-Git-Tag: 1.31.0-rc.0~42299 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=bf1401c2629d8edd7b88cd5f0f1329197b75a6a0;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 079cdc69b8..1c654dde8f 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -331,8 +331,7 @@ class ChangesList { $page = $rc->getTitle(); /** Check for rollback and edit permissions, disallow special pages, and only * show a link on the top-most revision */ - if( $page->quickUserCan('rollback') && $page->quickUserCan('edit') - && $page->getLatestRevID() == $rc->mAttribs['rc_this_oldid'] ) + if ($wgUser->isAllowed('rollback') && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid'] ) { $rev = new Revision( array( 'id' => $rc->mAttribs['rc_this_oldid'], diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index bc7b1e96f3..9aec76189c 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -285,7 +285,10 @@ class SpecialRecentChanges extends SpecialPage { $join_conds['watchlist'] = array('LEFT JOIN', "wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace"); } - + if ($wgUser->isAllowed("rollback")) { + $tables[] = 'page'; + $join_conds['page'] = array('LEFT JOIN', 'rc_namespace=page_namespace AND rc_title=page_title AND rc_this_oldid=page_latest'); + } // Tag stuff. $fields = array(); // Fields are * in this case, so let the function modify an empty array to keep it happy. ChangeTags::modifyDisplayQuery( $tables, $fields, $conds, $join_conds, $opts['tagfilter'] );