diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2009-06-10 13:00:47 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2009-06-10 13:00:47 +0200 |
commit | 72e90545454c0e014318fa3c81658e035aac58c1 (patch) | |
tree | 9212e3f46868989c4d57ae9a5c8a1a80e4dc0702 /includes/specials/SpecialListfiles.php | |
parent | 565a0ccc371ec1a2a0e9b39487cbac18e6f60e25 (diff) |
applying patch to version 1.15.0
Diffstat (limited to 'includes/specials/SpecialListfiles.php')
-rw-r--r-- | includes/specials/SpecialListfiles.php | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index d2178ee0..e15b6959 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -58,7 +58,7 @@ class ImageListPager extends TablePager { 'img_description' => wfMsg( 'listfiles_description' ), ); if( !$wgMiserMode ) { - $this->mFieldNames['COUNT(oi_archive_name)'] = wfMsg( 'listfiles_count' ); + $this->mFieldNames['count'] = wfMsg( 'listfiles_count' ); } } return $this->mFieldNames; @@ -74,11 +74,25 @@ class ImageListPager extends TablePager { $fields = array_keys( $this->getFieldNames() ); $fields[] = 'img_user'; $options = $join_conds = array(); + # Depends on $wgMiserMode - if( isset($this->mFieldNames['COUNT(oi_archive_name)']) ) { + if( isset( $this->mFieldNames['count'] ) ) { $tables[] = 'oldimage'; - $options = array('GROUP BY' => 'img_name'); - $join_conds = array('oldimage' => array('LEFT JOIN','oi_name = img_name') ); + + # Need to rewrite this one + foreach ( $fields as &$field ) + if ( $field == 'count' ) + $field = 'COUNT(oi_archive_name) as count'; + unset( $field ); + + $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( 'tables' => $tables, @@ -136,7 +150,7 @@ class ImageListPager extends TablePager { return $this->getSkin()->formatSize( $value ); case 'img_description': return $this->getSkin()->commentBlock( $value ); - case 'COUNT(oi_archive_name)': + case 'count': return intval($value)+1; } } |