Page MenuHomePhabricator

imageGalleryUser.patch

Authored By
bzimport
Nov 21 2014, 8:47 PM
Size
4 KB
Referenced Files
None
Subscribers
None

imageGalleryUser.patch

Index: includes/specials/SpecialListfiles.php
===================================================================
--- includes/specials/SpecialListfiles.php (revision 63755)
+++ includes/specials/SpecialListfiles.php (working copy)
@@ -41,7 +41,11 @@
strtolower( $nt->getDBkey() ), $dbr->anyString() ) );
}
}
-
+ $user = $wgRequest->getText( 'user', '' );
+ $user = Title::makeTitleSafe( NS_USER, $user );
+ if ( $user ) {
+ $this->mQueryConds['img_user_text'] = $user->getText();
+ }
parent::__construct();
}
@@ -158,11 +162,14 @@
function getForm() {
global $wgRequest, $wgScript, $wgMiserMode;
$search = $wgRequest->getText( 'ilsearch' );
+ $user = $wgRequest->getText( 'user' );
$s = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' ) ) .
Xml::openElement( 'fieldset' ) .
Xml::element( 'legend', null, wfMsg( 'listfiles' ) ) .
- Xml::tags( 'label', null, wfMsgHtml( 'table_pager_limit', $this->getLimitSelect() ) );
+ Xml::tags( 'label', null, wfMsgHtml( 'table_pager_limit', $this->getLimitSelect() ) ) .
+ Xml::element( 'br' ) .
+ Xml::inputLabel( wfMsg( 'listfiles_search_user' ), 'user', 'mw-iluser', 20, $user );
if ( !$wgMiserMode ) {
$s .= "<br />\n" .
@@ -170,7 +177,7 @@
}
$s .= ' ' .
Xml::submitButton( wfMsg( 'table_pager_limit_submit' ) ) ."\n" .
- $this->getHiddenFields( array( 'limit', 'ilsearch' ) ) .
+ $this->getHiddenFields( array( 'limit', 'ilsearch', 'user' ) ) .
Xml::closeElement( 'fieldset' ) .
Xml::closeElement( 'form' ) . "\n";
return $s;
Index: includes/specials/SpecialNewimages.php
===================================================================
--- includes/specials/SpecialNewimages.php (revision 63755)
+++ includes/specials/SpecialNewimages.php (working copy)
@@ -13,7 +13,18 @@
$sk = $wgUser->getSkin();
$shownav = !$specialPage->including();
$hidebots = $wgRequest->getBool( 'hidebots' , 1 );
+ $user = $wgRequest->getText( 'user', '' );
+ $usersql = '';
+ if ( $user !== '' ) {
+ $user = Title::makeTitleSafe( NS_USER, $user );
+ if ( $user != null ) {
+ $user = $user->getText();
+ $usersql = ' img_user_text = ' . $dbr->addQuotes( $user );
+ # using img_user_text instead of img_user, as that has index
+ }
+ }
+
$hidebotsql = '';
if ( $hidebots ) {
# Make a list of group names which have the 'bot' flag set.
@@ -74,6 +85,11 @@
}
}
+ if ( $user ) {
+ $where[] = $usersql;
+ $searchpar['user'] = $user;
+ }
+
$invertSort = false;
if( $until = $wgRequest->getVal( 'until' ) ) {
$where[] = "img_timestamp < '" . $dbr->timestamp( $until ) . "'";
@@ -138,11 +154,18 @@
$titleObj = SpecialPage::getTitleFor( 'Newimages' );
$action = $titleObj->getLocalURL( $hidebots ? '' : 'hidebots=0' );
- if ( $shownav && !$wgMiserMode ) {
+ if ( $shownav ) {
$wgOut->addHTML(
Xml::openElement( 'form', array( 'action' => $action, 'method' => 'post', 'id' => 'imagesearch' ) ) .
Xml::fieldset( wfMsg( 'newimages-legend' ) ) .
- Xml::inputLabel( wfMsg( 'newimages-label' ), 'wpIlMatch', 'wpIlMatch', 20, $wpIlMatch ) . ' ' .
+ Xml::inputLabel( wfMsg( 'newimages-user' ), 'user', 'mw-niuser', 20, $user ) . ' '
+ );
+ if ( !$wgMiserMode ) {
+ $wgOut->addHTML(
+ Xml::inputLabel( wfMsg( 'newimages-label' ), 'wpIlMatch', 'wpIlMatch', 20, $wpIlMatch ) . ' '
+ );
+ }
+ $wgOut->addHTML(
Xml::submitButton( wfMsg( 'ilsubmit' ), array( 'name' => 'wpIlSubmit' ) ) .
Xml::closeElement( 'fieldset' ) .
Xml::closeElement( 'form' )
Index: languages/messages/MessagesEn.php
===================================================================
--- languages/messages/MessagesEn.php (revision 63755)
+++ languages/messages/MessagesEn.php (working copy)
@@ -2189,6 +2189,7 @@
By default the last uploaded files are shown at top of the list.
A click on a column header changes the sorting.',
'listfiles_search_for' => 'Search for media name:',
+'listfiles_search_user' => 'Username:',
'imgfile' => 'file',
'listfiles' => 'File list',
'listfiles_date' => 'Date',
@@ -3483,6 +3484,7 @@
'newimages-summary' => 'This special page shows the last uploaded files.',
'newimages-legend' => 'Filter',
'newimages-label' => 'Filename (or a part of it):',
+'newimages-user' => 'Username:',
'showhidebots' => '($1 bots)',
'noimages' => 'Nothing to see.',
'ilsubmit' => 'Search',

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1835
Default Alt Text
imageGalleryUser.patch (4 KB)

Event Timeline