$prefix = $table === 'oldimage' ? 'oi' : 'img';
$tables = [ $table ];
- $fields = array_keys( $this->getFieldNames() );
+ $fields = $this->getFieldNames();
+ unset( $fields['img_description'] );
+ $fields = array_keys( $fields );
if ( $table === 'oldimage' ) {
foreach ( $fields as $id => &$field ) {
$options = $join_conds = [];
+ # Description field
+ $commentQuery = CommentStore::newKey( $prefix . '_description' )->getJoin();
+ $tables += $commentQuery['tables'];
+ $fields += $commentQuery['fields'];
+ $join_conds += $commentQuery['joins'];
+ $fields['description_field'] = "'{$prefix}_description'";
+
# Depends on $wgMiserMode
# Will also not happen if mShowAll is true.
if ( isset( $this->mFieldNames['count'] ) ) {
}
unset( $field );
- $dbr = wfGetDB( DB_REPLICA );
- if ( $dbr->implicitGroupby() ) {
- $options = [ 'GROUP BY' => 'img_name' ];
- } else {
- $columnlist = preg_grep( '/^img/', array_keys( $this->getFieldNames() ) );
- $options = [ 'GROUP BY' => array_merge( [ 'img_user' ], $columnlist ) ];
- }
- $join_conds = [ 'oldimage' => [ 'LEFT JOIN', 'oi_name = img_name' ] ];
+ $columnlist = preg_grep( '/^img/', array_keys( $this->getFieldNames() ) );
+ $options = [ 'GROUP BY' => array_merge( [ 'img_user' ], $columnlist ) ];
+ $join_conds['oldimage'] = [ 'LEFT JOIN', 'oi_name = img_name' ];
}
return [
}
}
- // @codingStandardsIgnoreStart Squiz.WhiteSpace.SemicolonSpacing.Incorrect
for ( ; $i < $limit && $topRes1; $i++ ) {
- // @codingStandardsIgnoreEnd
$resultArray[] = $topRes1;
$topRes1 = $res1->next();
}
- // @codingStandardsIgnoreStart Squiz.WhiteSpace.SemicolonSpacing.Incorrect
for ( ; $i < $limit && $topRes2; $i++ ) {
- // @codingStandardsIgnoreEnd
$resultArray[] = $topRes2;
$topRes2 = $res2->next();
}
case 'img_size':
return htmlspecialchars( $this->getLanguage()->formatSize( $value ) );
case 'img_description':
+ $field = $this->mCurrentRow->description_field;
+ $value = CommentStore::newKey( $field )->getComment( $this->mCurrentRow )->text;
return Linker::formatComment( $value );
case 'count':
return $this->getLanguage()->formatNum( intval( $value ) + 1 );