jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/341767 )

Change subject: Allow filtering on newbies in Special:NewFiles
......................................................................


Allow filtering on newbies in Special:NewFiles

Bug: T122354
Change-Id: I4b659a78e70a5102bc8592816160df888e9fc439
---
M includes/specials/SpecialNewimages.php
M includes/specials/pagers/NewFilesPager.php
M languages/i18n/en.json
M languages/i18n/qqq.json
4 files changed, 23 insertions(+), 0 deletions(-)

Approvals:
  MarkTraceur: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialNewimages.php 
b/includes/specials/SpecialNewimages.php
index 583d4f9..bc4eed7 100644
--- a/includes/specials/SpecialNewimages.php
+++ b/includes/specials/SpecialNewimages.php
@@ -42,6 +42,7 @@
                $opts->add( 'like', '' );
                $opts->add( 'user', '' );
                $opts->add( 'showbots', false );
+               $opts->add( 'newbies', false );
                $opts->add( 'hidepatrolled', false );
                $opts->add( 'limit', 50 );
                $opts->add( 'offset', '' );
@@ -98,6 +99,12 @@
                                'name' => 'user',
                        ],
 
+                       'newbies' => [
+                               'type' => 'check',
+                               'label-message' => 'newimages-newbies',
+                               'name' => 'newbies',
+                       ],
+
                        'showbots' => [
                                'type' => 'check',
                                'label-message' => 'newimages-showbots',
diff --git a/includes/specials/pagers/NewFilesPager.php 
b/includes/specials/pagers/NewFilesPager.php
index cce0323..07e9951 100644
--- a/includes/specials/pagers/NewFilesPager.php
+++ b/includes/specials/pagers/NewFilesPager.php
@@ -74,6 +74,20 @@
                        }
                }
 
+               if ( $opts->getValue( 'newbies' ) ) {
+                       // newbie = most recent 1% of users
+                       $dbr = wfGetDB( DB_REPLICA );
+                       $max = $dbr->selectField( 'user', 'max(user_id)', 
false, __METHOD__ );
+                       $conds[] = 'img_user >' . (int)( $max - $max / 100 );
+
+                       // there's no point in looking for new user activity in 
a far past;
+                       // beyond a certain point, we'd just end up scanning 
the rest of the
+                       // table even though the users we're looking for didn't 
yet exist...
+                       // see T140537, (for ContribsPages, but similar to this)
+                       $conds[] = 'img_timestamp > ' .
+                               $dbr->addQuotes( $dbr->timestamp( wfTimestamp() 
- 30 * 24 * 60 * 60 ) );
+               }
+
                if ( !$opts->getValue( 'showbots' ) ) {
                        $groupsWithBotPermission = 
User::getGroupsWithPermission( 'bot' );
 
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 9fe0e3c..86478e8 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -3042,6 +3042,7 @@
        "newimages-legend": "Filter",
        "newimages-label": "Filename (or a part of it):",
        "newimages-user": "IP address or username",
+       "newimages-newbies": "Show contributions of new accounts only",
        "newimages-showbots": "Show uploads by bots",
        "newimages-hidepatrolled": "Hide patrolled uploads",
        "noimages": "Nothing to see.",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index 4d46e6f..f48dfe3 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -3232,6 +3232,7 @@
        "newimages-legend": "Caption of the fieldset for the filter on 
[[Special:NewImages]]\n\n{{Identical|Filter}}",
        "newimages-label": "Caption of the filter editbox on 
[[Special:NewImages]]",
        "newimages-user": "Caption of the username/IP address editbox on 
[[Special:NewImages]]",
+       "newimages-newbies": "Used as label for a checkbox. When checked, 
[[Special:NewImages]] will only display uploads by new users.",
        "newimages-showbots": "Used as label for a checkbox. When checked, 
[[Special:NewImages]] will also display uploads by users in the bots group.",
        "newimages-hidepatrolled": "Used as label for a checkbox. When checked, 
[[Special:NewImages]] will not display patrolled uploads.\n\nCf. 
{{msg-mw|tog-hidepatrolled}} and 
{{msg-mw|apihelp-feedrecentchanges-param-hidepatrolled}}.",
        "noimages": "This is shown on the special page [[Special:NewImages]], 
when there aren't any recently uploaded files.",

-- 
To view, visit https://gerrit.wikimedia.org/r/341767
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4b659a78e70a5102bc8592816160df888e9fc439
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to