| Index: trunk/phase3/includes/specials/SpecialListfiles.php |
| — | — | @@ -7,10 +7,10 @@ |
| 8 | 8 | /** |
| 9 | 9 | * |
| 10 | 10 | */ |
| 11 | | -function wfSpecialListfiles() { |
| | 11 | +function wfSpecialListfiles( $par = null ) { |
| 12 | 12 | global $wgOut; |
| 13 | 13 | |
| 14 | | - $pager = new ImageListPager; |
| | 14 | + $pager = new ImageListPager( $par ); |
| 15 | 15 | |
| 16 | 16 | $limit = $pager->getForm(); |
| 17 | 17 | $body = $pager->getBody(); |
| — | — | @@ -24,21 +24,30 @@ |
| 25 | 25 | class ImageListPager extends TablePager { |
| 26 | 26 | var $mFieldNames = null; |
| 27 | 27 | var $mQueryConds = array(); |
| 28 | | - |
| 29 | | - function __construct() { |
| | 28 | + |
| | 29 | + function __construct( $par = null ) { |
| 30 | 30 | global $wgRequest, $wgMiserMode; |
| 31 | 31 | if ( $wgRequest->getText( 'sort', 'img_date' ) == 'img_date' ) { |
| 32 | 32 | $this->mDefaultDirection = true; |
| 33 | 33 | } else { |
| 34 | 34 | $this->mDefaultDirection = false; |
| 35 | 35 | } |
| | 36 | + |
| | 37 | + $userName = $wgRequest->getText( 'username', $par ); |
| | 38 | + if ( $userName ) { |
| | 39 | + $nt = Title::newFromText( $userName, NS_USER ); |
| | 40 | + if ( !is_null( $nt ) ) { |
| | 41 | + $this->mQueryConds['img_user_text'] = $nt->getText(); |
| | 42 | + } |
| | 43 | + } |
| | 44 | + |
| 36 | 45 | $search = $wgRequest->getText( 'ilsearch' ); |
| 37 | 46 | if ( $search != '' && !$wgMiserMode ) { |
| 38 | 47 | $nt = Title::newFromURL( $search ); |
| 39 | 48 | if( $nt ) { |
| 40 | 49 | $dbr = wfGetDB( DB_SLAVE ); |
| 41 | | - $this->mQueryConds = array( 'LOWER(img_name)' . $dbr->buildLike( $dbr->anyString(), |
| 42 | | - strtolower( $nt->getDBkey() ), $dbr->anyString() ) ); |
| | 50 | + $this->mQueryConds[] = 'LOWER(img_name)' . $dbr->buildLike( $dbr->anyString(), |
| | 51 | + strtolower( $nt->getDBkey() ), $dbr->anyString() ); |
| 43 | 52 | } |
| 44 | 53 | } |
| 45 | 54 | |
| — | — | @@ -63,7 +72,11 @@ |
| 64 | 73 | } |
| 65 | 74 | |
| 66 | 75 | function isFieldSortable( $field ) { |
| 67 | | - static $sortable = array( 'img_timestamp', 'img_name', 'img_size' ); |
| | 76 | + static $sortable = array( 'img_timestamp', 'img_name' ); |
| | 77 | + if ( $field == 'img_size' ) { |
| | 78 | + # No index for both img_size and img_user_text |
| | 79 | + return !isset( $this->mQueryConds['img_user_text'] ); |
| | 80 | + } |
| 68 | 81 | return in_array( $field, $sortable ); |
| 69 | 82 | } |
| 70 | 83 | |
| Index: trunk/phase3/RELEASE-NOTES |
| — | — | @@ -45,6 +45,7 @@ |
| 46 | 46 | viewing contributions of a blocked IP address |
| 47 | 47 | * (bug 22474) {{urlencode:}} now takes an optional second paramter for type of |
| 48 | 48 | escaping. |
| | 49 | +* Special:Listfiles now supports a username parameter |
| 49 | 50 | |
| 50 | 51 | === Bug fixes in 1.17 === |
| 51 | 52 | * (bug 17560) Half-broken deletion moved image files to deletion archive |