Add all columns to GROUP BY for databases that need them (e.g. not MySQL).
authorGreg Sabino Mullane <greg@users.mediawiki.org>
Thu, 12 Mar 2009 14:26:05 +0000 (14:26 +0000)
committerGreg Sabino Mullane <greg@users.mediawiki.org>
Thu, 12 Mar 2009 14:26:05 +0000 (14:26 +0000)
Fixes bug 17676

includes/specials/SpecialListfiles.php

index d2178ee..3953a53 100644 (file)
@@ -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(