From c72fb7a1776e1c0c4673f0004b3491786827ad8f Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Thu, 12 Mar 2009 14:26:05 +0000 Subject: [PATCH] Add all columns to GROUP BY for databases that need them (e.g. not MySQL). Fixes bug 17676 --- includes/specials/SpecialListfiles.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index d2178ee02f..3953a53819 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -77,7 +77,13 @@ class ImageListPager extends TablePager { # Depends on $wgMiserMode if( isset($this->mFieldNames['COUNT(oi_archive_name)']) ) { $tables[] = 'oldimage'; - $options = array('GROUP BY' => 'img_name'); + $dbr = wfGetDB( DB_SLAVE ); + if( $dbr->implicitGroupby() ) { + $options = array('GROUP BY' => 'img_name'); + } else { + $columnlist = implode( ',', preg_grep( '/^img/', array_keys( $this->getFieldNames() ) ) ); + $options = array('GROUP BY' => "img_user, $columnlist"); + } $join_conds = array('oldimage' => array('LEFT JOIN','oi_name = img_name') ); } return array( -- 2.20.1