# 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(