X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fspecials%2Fpagers%2FImageListPager.php;h=75c2f776ab3817385cd9318fa17138fb4a730328;hb=27c61fb1e94da9114314468fd00bcf129ec064b6;hp=ae19d59c87fcf21f98702c5eb89ed04151dbe679;hpb=b610a3b617f7616b2f1db12498cbad5aeae12576;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/pagers/ImageListPager.php b/includes/specials/pagers/ImageListPager.php index ae19d59c87..75c2f776ab 100644 --- a/includes/specials/pagers/ImageListPager.php +++ b/includes/specials/pagers/ImageListPager.php @@ -193,9 +193,9 @@ class ImageListPager extends TablePager { } $sortable = [ 'img_timestamp', 'img_name', 'img_size' ]; /* For reference, the indicies we can use for sorting are: - * On the image table: img_user_timestamp, img_usertext_timestamp, + * On the image table: img_user_timestamp/img_usertext_timestamp/img_actor_timestamp, * img_size, img_timestamp - * On oldimage: oi_usertext_timestamp, oi_name_timestamp + * On oldimage: oi_usertext_timestamp/oi_actor_timestamp, oi_name_timestamp * * In particular that means we cannot sort by timestamp when not filtering * by user and including old images in the results. Which is sad. @@ -246,6 +246,7 @@ class ImageListPager extends TablePager { $tables = [ $table ]; $fields = $this->getFieldNames(); unset( $fields['img_description'] ); + unset( $fields['img_user_text'] ); $fields = array_keys( $fields ); if ( $table === 'oldimage' ) { @@ -261,7 +262,6 @@ class ImageListPager extends TablePager { $fields[array_search( 'top', $fields )] = "'yes' AS top"; } } - $fields[] = $prefix . '_user AS img_user'; $fields[array_search( 'thumb', $fields )] = $prefix . '_name AS thumb'; $options = $join_conds = []; @@ -273,6 +273,14 @@ class ImageListPager extends TablePager { $join_conds += $commentQuery['joins']; $fields['description_field'] = "'{$prefix}_description'"; + # User fields + $actorQuery = ActorMigration::newMigration()->getJoin( $prefix . '_user' ); + $tables += $actorQuery['tables']; + $join_conds += $actorQuery['joins']; + $fields['img_user'] = $actorQuery['fields'][$prefix . '_user']; + $fields['img_user_text'] = $actorQuery['fields'][$prefix . '_user_text']; + $fields['img_actor'] = $actorQuery['fields'][$prefix . '_actor']; + # Depends on $wgMiserMode # Will also not happen if mShowAll is true. if ( isset( $this->mFieldNames['count'] ) ) { @@ -287,7 +295,7 @@ class ImageListPager extends TablePager { unset( $field ); $columnlist = preg_grep( '/^img/', array_keys( $this->getFieldNames() ) ); - $options = [ 'GROUP BY' => array_merge( [ 'img_user' ], $columnlist ) ]; + $options = [ 'GROUP BY' => array_merge( [ $fields['img_user'] ], $columnlist ) ]; $join_conds['oldimage'] = [ 'LEFT JOIN', 'oi_name = img_name' ]; }