r65035 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65034‎ | r65035 | r65036 >
Date:16:15, 14 April 2010
Author:btongminh
Status:ok
Tags:
Comment:
Follow-up to r65013: Preserve username when clicking navigation links.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialListfiles.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialListfiles.php
@@ -24,6 +24,7 @@
2525 class ImageListPager extends TablePager {
2626 var $mFieldNames = null;
2727 var $mQueryConds = array();
 28+ var $mUserName = null;
2829
2930 function __construct( $par = null ) {
3031 global $wgRequest, $wgMiserMode;
@@ -37,14 +38,15 @@
3839 if ( $userName ) {
3940 $nt = Title::newFromText( $userName, NS_USER );
4041 if ( !is_null( $nt ) ) {
41 - $this->mQueryConds['img_user_text'] = $nt->getText();
 42+ $this->mUserName = $nt->getText();
 43+ $this->mQueryConds['img_user_text'] = $this->mUserName;
4244 }
4345 }
4446
4547 $search = $wgRequest->getText( 'ilsearch' );
4648 if ( $search != '' && !$wgMiserMode ) {
4749 $nt = Title::newFromURL( $search );
48 - if( $nt ) {
 50+ if ( $nt ) {
4951 $dbr = wfGetDB( DB_SLAVE );
5052 $this->mQueryConds[] = 'LOWER(img_name)' . $dbr->buildLike( $dbr->anyString(),
5153 strtolower( $nt->getDBkey() ), $dbr->anyString() );
@@ -200,4 +202,15 @@
201203 function getSortHeaderClass() {
202204 return 'listfiles_sort ' . parent::getSortHeaderClass();
203205 }
 206+
 207+ function getPagingQueries() {
 208+ $queries = parent::getPagingQueries();
 209+ if ( !is_null( $this->mUserName ) ) {
 210+ # Append the username to the query string
 211+ foreach ( $queries as $key => &$query ) {
 212+ $query['username'] = $this->mUserName;
 213+ }
 214+ }
 215+ return $queries;
 216+ }
204217 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r84118(follow-up r65035/r65013) The username parameter wasn't preserved when clicki...bawolff18:23, 16 March 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r65013Special:Listfiles now supports a username parameter. This is indexed using th...btongminh09:03, 14 April 2010

Status & tagging log