summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialListfiles.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialListfiles.php')
-rw-r--r--includes/specials/SpecialListfiles.php60
1 files changed, 30 insertions, 30 deletions
diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php
index b5754991..cc055221 100644
--- a/includes/specials/SpecialListfiles.php
+++ b/includes/specials/SpecialListfiles.php
@@ -107,15 +107,15 @@ class ImageListPager extends TablePager {
if ( !$this->mFieldNames ) {
global $wgMiserMode;
$this->mFieldNames = array(
- 'img_timestamp' => wfMsg( 'listfiles_date' ),
- 'img_name' => wfMsg( 'listfiles_name' ),
- 'thumb' => wfMsg( 'listfiles_thumb' ),
- 'img_size' => wfMsg( 'listfiles_size' ),
- 'img_user_text' => wfMsg( 'listfiles_user' ),
- 'img_description' => wfMsg( 'listfiles_description' ),
+ 'img_timestamp' => $this->msg( 'listfiles_date' )->text(),
+ 'img_name' => $this->msg( 'listfiles_name' )->text(),
+ 'thumb' => $this->msg( 'listfiles_thumb' )->text(),
+ 'img_size' => $this->msg( 'listfiles_size' )->text(),
+ 'img_user_text' => $this->msg( 'listfiles_user' )->text(),
+ 'img_description' => $this->msg( 'listfiles_description' )->text(),
);
if( !$wgMiserMode ) {
- $this->mFieldNames['count'] = wfMsg( 'listfiles_count' );
+ $this->mFieldNames['count'] = $this->msg( 'listfiles_count' )->text();
}
}
return $this->mFieldNames;
@@ -156,9 +156,8 @@ class ImageListPager extends TablePager {
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" );
+ $columnlist = preg_grep( '/^img/', array_keys( $this->getFieldNames() ) );
+ $options = array( 'GROUP BY' => array_merge( array( 'img_user' ), $columnlist ) );
}
$join_conds = array( 'oldimage' => array( 'LEFT JOIN', 'oi_name = img_name' ) );
}
@@ -175,20 +174,14 @@ class ImageListPager extends TablePager {
return 'img_timestamp';
}
- function getStartBody() {
- # Do a link batch query for user pages
- if ( $this->mResult->numRows() ) {
- $lb = new LinkBatch;
- $this->mResult->seek( 0 );
- foreach ( $this->mResult as $row ) {
- if ( $row->img_user ) {
- $lb->add( NS_USER, str_replace( ' ', '_', $row->img_user_text ) );
- }
- }
- $lb->execute();
+ function doBatchLookups() {
+ $userIds = array();
+ $this->mResult->seek( 0 );
+ foreach ( $this->mResult as $row ) {
+ $userIds[] = $row->img_user;
}
-
- return parent::getStartBody();
+ # Do a link batch query for names and userpages
+ UserCache::singleton()->doQuery( $userIds, array( 'userpage' ), __METHOD__ );
}
function formatValue( $field, $value ) {
@@ -198,10 +191,10 @@ class ImageListPager extends TablePager {
$thumb = $file->transform( array( 'width' => 180, 'height' => 360 ) );
return $thumb->toHtml( array( 'desc-link' => true ) );
case 'img_timestamp':
- return htmlspecialchars( $this->getLanguage()->timeanddate( $value, true ) );
+ return htmlspecialchars( $this->getLanguage()->userTimeAndDate( $value, $this->getUser() ) );
case 'img_name':
static $imgfile = null;
- if ( $imgfile === null ) $imgfile = wfMsg( 'imgfile' );
+ if ( $imgfile === null ) $imgfile = $this->msg( 'imgfile' )->text();
// Weird files can maybe exist? Bug 22227
$filePage = Title::makeTitleSafe( NS_FILE, $value );
@@ -211,15 +204,17 @@ class ImageListPager extends TablePager {
array( 'href' => wfLocalFile( $filePage )->getURL() ),
$imgfile
);
- return "$link ($download)";
+ $download = $this->msg( 'parentheses' )->rawParams( $download )->escaped();
+ return "$link $download";
} else {
return htmlspecialchars( $value );
}
case 'img_user_text':
if ( $this->mCurrentRow->img_user ) {
+ $name = User::whoIs( $this->mCurrentRow->img_user );
$link = Linker::link(
- Title::makeTitle( NS_USER, $value ),
- htmlspecialchars( $value )
+ Title::makeTitle( NS_USER, $name ),
+ htmlspecialchars( $name )
);
} else {
$link = htmlspecialchars( $value );
@@ -253,9 +248,10 @@ class ImageListPager extends TablePager {
) );
return Html::openElement( 'form',
array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' ) ) .
- Xml::fieldset( wfMsg( 'listfiles' ) ) .
+ Xml::fieldset( $this->msg( 'listfiles' )->text() ) .
+ Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
Xml::buildForm( $inputForm, 'table_pager_limit_submit' ) .
- $this->getHiddenFields( array( 'limit', 'ilsearch', 'user' ) ) .
+ $this->getHiddenFields( array( 'limit', 'ilsearch', 'user', 'title' ) ) .
Html::closeElement( 'fieldset' ) .
Html::closeElement( 'form' ) . "\n";
}
@@ -290,4 +286,8 @@ class ImageListPager extends TablePager {
}
return $queries;
}
+
+ function getTitle() {
+ return SpecialPage::getTitleFor( 'Listfiles' );
+ }
}