From: Greg Sabino Mullane Date: Sun, 15 Nov 2009 23:31:16 +0000 (+0000) Subject: Allow $wgMaxCredits to work for database backends with non-magic group by behavior. X-Git-Tag: 1.31.0-rc.0~38787 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=f00296da03b607cda7583ee58634f9e957fb1b4a;p=lhc%2Fweb%2Fwiklou.git Allow $wgMaxCredits to work for database backends with non-magic group by behavior. Bug 21196 --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d7ad7ae4d7..ce4d7096ce 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -636,6 +636,8 @@ Hopefully we will remove this configuration var soon) * (bug 19391) Fix caching for Recent ChangesFeed. * (bug 21455) Fixed "Watch this page" checkbox appearing on some special pages even to non-logged in users +* (bug 21196) Allow $wgMaxCredits to work for Postgres (and possible other + non-MySQL) backends. == API changes in 1.16 == diff --git a/includes/Article.php b/includes/Article.php index 3fb548a4bc..e06bd45144 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -710,12 +710,19 @@ class Article { $deletedBit = $dbr->bitAnd( 'rev_deleted', Revision::DELETED_USER ); // username hidden? - $sql = "SELECT {$userTable}.*, rev_user_text as user_name, MAX(rev_timestamp) as timestamp - FROM $revTable LEFT JOIN $userTable ON rev_user = user_id + $groupby = 'rev_user, rev_user_text'; + if (! $dbr->implicitGroupby()) { + $groupby .= ', user_id, user_name, user_real_name, user_email, user_editcount'; + } + + $sql = "SELECT user_id, user_name, user_real_name, user_email, user_editcount, + rev_user_text AS user_name, MAX(rev_timestamp) AS timestamp + FROM $revTable + LEFT JOIN $userTable ON rev_user = user_id WHERE rev_page = $pageId $excludeCond AND $deletedBit = 0 - GROUP BY rev_user, rev_user_text + GROUP BY $groupby ORDER BY timestamp DESC"; if ( $limit > 0 )