Merge "Allow filtering by username on Special:NewFiles"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 29 Mar 2017 14:11:40 +0000 (14:11 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 29 Mar 2017 14:11:40 +0000 (14:11 +0000)
1  2 
includes/api/ApiQueryAllImages.php
languages/i18n/en.json
languages/i18n/qqq.json

@@@ -26,8 -26,6 +26,8 @@@
   * @file
   */
  
 +use Wikimedia\Rdbms\IDatabase;
 +
  /**
   * Query module to enumerate all available pages.
   *
@@@ -87,6 -85,7 +87,7 @@@ class ApiQueryAllImages extends ApiQuer
                $db = $this->getDB();
  
                $params = $this->extractRequestParams();
+               $userId = !is_null( $params['user'] ) ? User::idFromName( $params['user'] ) : null;
  
                // Table and return fields
                $this->addTables( 'image' );
  
                        // Image filters
                        if ( !is_null( $params['user'] ) ) {
-                               $this->addWhereFld( 'img_user_text', $params['user'] );
+                               if ( $userId ) {
+                                       $this->addWhereFld( 'img_user', $userId );
+                               } else {
+                                       $this->addWhereFld( 'img_user_text', $params['user'] );
+                               }
                        }
                        if ( $params['filterbots'] != 'all' ) {
                                $this->addTables( 'user_groups' );
                if ( $params['sort'] == 'timestamp' ) {
                        $this->addOption( 'ORDER BY', 'img_timestamp' . $sortFlag );
                        if ( !is_null( $params['user'] ) ) {
-                               $this->addOption( 'USE INDEX', [ 'image' => 'img_usertext_timestamp' ] );
+                               if ( $userId ) {
+                                       $this->addOption( 'USE INDEX', [ 'image' => 'img_user_timestamp' ] );
+                               } else {
+                                       $this->addOption( 'USE INDEX', [ 'image' => 'img_usertext_timestamp' ] );
+                               }
                        } else {
                                $this->addOption( 'USE INDEX', [ 'image' => 'img_timestamp' ] );
                        }
diff --combined languages/i18n/en.json
        "post-expand-template-argument-warning": "<strong>Warning:</strong> This page contains at least one template argument that has a too large expansion size.\nThese arguments have been omitted.",
        "post-expand-template-argument-category": "Pages containing omitted template arguments",
        "parser-template-loop-warning": "Template loop detected: [[$1]]",
 +      "template-loop-category": "Pages with template loops",
 +      "template-loop-category-desc": "The page contains a template loop, ie. a template which calls itself recursively.",
        "parser-template-recursion-depth-warning": "Template recursion depth limit exceeded ($1)",
        "language-converter-depth-warning": "Language converter depth limit exceeded ($1)",
        "node-count-exceeded-category": "Pages where node count is exceeded",
        "page_first": "first",
        "page_last": "last",
        "histlegend": "Diff selection: Mark the radio boxes of the revisions to compare and hit enter or the button at the bottom.<br />\nLegend: <strong>({{int:cur}})</strong> = difference with latest revision, <strong>({{int:last}})</strong> = difference with preceding revision, <strong>{{int:minoreditletter}}</strong> = minor edit.",
 -      "history-fieldset-title": "Browse history",
 -      "history-show-deleted": "Deleted only",
 +      "history-fieldset-title": "Search for revisions",
 +      "history-show-deleted": "Revision deleted only",
        "history_copyright": "-",
        "histfirst": "oldest",
        "histlast": "newest",
        "prefs-help-prefershttps": "This preference will take effect on your next login.",
        "prefswarning-warning": "You've made changes to your preferences that have not been saved yet.\nIf you leave this page without clicking \"$1\" your preferences will not be updated.",
        "prefs-tabs-navigation-hint": "Tip: You can use the left and right arrow keys to navigate between the tabs in the tabs list.",
 -      "userrights": "User rights management",
 +      "userrights": "User rights",
        "userrights-summary": "",
        "userrights-lookup-user": "Select a user",
        "userrights-user-editname": "Enter a username:",
        "recentchanges-legend": "Recent changes options",
        "recentchanges-summary": "Track the most recent changes to the wiki on this page.",
        "recentchangestext": "-",
 -      "recentchanges-noresult": "No changes during the given period matching these criteria.",
 +      "recentchanges-noresult": "No changes during the given period match these criteria.",
        "recentchanges-feed-description": "Track the most recent changes to the wiki in this feed.",
        "recentchanges-label-newpage": "This edit created a new page",
        "recentchanges-label-minor": "This is a minor edit",
        "rcfilters-invalid-filter": "Invalid filter",
        "rcfilters-empty-filter": "No active filters. All contributions are shown.",
        "rcfilters-filterlist-title": "Filters",
 +      "rcfilters-filterlist-whatsthis": "What's this?",
        "rcfilters-filterlist-feedbacklink": "Provide feedback on the new (beta) filters",
        "rcfilters-highlightbutton-title": "Highlight results",
        "rcfilters-highlightmenu-title": "Select a color",
        "rcfilters-highlightmenu-help": "Select a color to highlight this property",
        "rcfilters-filterlist-noresults": "No filters found",
 +      "rcfilters-noresults-conflict": "No results found because the search criteria are in conflict",
 +      "rcfilters-state-message-subset": "This filter has no effect because its results are included with those of the following, broader {{PLURAL:$2|filter|filters}} (try highlighting to distinguish it): $1",
 +      "rcfilters-state-message-fullcoverage": "Selecting all filters in a group is the same as selecting none, so this filter has no effect. Group includes: $1",
        "rcfilters-filtergroup-registration": "User registration",
        "rcfilters-filter-registered-label": "Registered",
        "rcfilters-filter-registered-description": "Logged-in editors.",
        "rcfilters-filter-unregistered-label": "Unregistered",
        "rcfilters-filter-unregistered-description": "Editors who aren’t logged in.",
 -      "rcfilters-filter-unregistered-conflicts-user-experience-level": "The \"Unregistered\" filter is inactive because its effect is being canceled by the following Experience {{PLURAL:$2|filter|filters}}, which {{PLURAL:$2|finds|find}} only registered users: $1",
 +      "rcfilters-filter-unregistered-conflicts-user-experience-level": "This filter conflicts with the following Experience {{PLURAL:$2|filter|filters}}, which {{PLURAL:$2|finds|find}} only registered users: $1",
        "rcfilters-filtergroup-authorship": "Edit authorship",
        "rcfilters-filter-editsbyself-label": "Your own edits",
        "rcfilters-filter-editsbyself-description": "Edits by you.",
        "rcfilters-filter-editsbyother-label": "Edits by others",
        "rcfilters-filter-editsbyother-description": "Edits created by other users (not you).",
        "rcfilters-filtergroup-userExpLevel": "Experience level (for registered users only)",
 -      "rcfilters-filtergroup-user-experience-level-conflicts-unregistered": "This filter is inactive because it finds only registered users, so the \"Unregistered\" filter is canceling its effect.",
 -      "rcfilters-filtergroup-user-experience-level-conflicts-unregistered-global": "The \"Unregistered\" filter is in conflict with one or more Experience filters. Experience filters find registered users only. The conflicting filters are marked as inactive above.",
 +      "rcfilters-filtergroup-user-experience-level-conflicts-unregistered": "Experience filters find only registered users, so this filter conflicts with the “Unregistered” filter.",
 +      "rcfilters-filtergroup-user-experience-level-conflicts-unregistered-global": "The \"Unregistered\" filter conflicts with one or more Experience filters, which find registered users only. The conflicting filters are marked in the Active Filters area, above.",
        "rcfilters-filter-user-experience-level-newcomer-label": "Newcomers",
        "rcfilters-filter-user-experience-level-newcomer-description": "Fewer than 10 edits and 4 days of activity.",
        "rcfilters-filter-user-experience-level-learner-label": "Learners",
        "rcfilters-filter-categorization-description": "Records of pages being added or removed from categories.",
        "rcfilters-filter-logactions-label": "Logged actions",
        "rcfilters-filter-logactions-description": "Administrative actions, account creations, page deletions, uploads....",
 +      "rcfilters-hideminor-conflicts-typeofchange-global": "The \"Minor edits\" filter conflicts with one or more Type of Change filters, because certain types of change cannot be designated as \"minor.\" The conflicting filters are marked in the Active Filters area, above.",
 +      "rcfilters-hideminor-conflicts-typeofchange": "Certain types of change cannot be designated as \"minor,\" so this filter conflicts with the following Type of Change filters: $1",
 +      "rcfilters-typeofchange-conflicts-hideminor": "This Type of Change filter conflicts with the \"Minor Edits\" filter. Certain types of change cannot be designated as \"minor.\"",
        "rcnotefrom": "Below {{PLURAL:$5|is the change|are the changes}} since <strong>$3, $4</strong> (up to <strong>$1</strong> shown).",
        "rclistfrom": "Show new changes starting from $2, $3",
        "rcshowhideminor": "$1 minor edits",
        "newimages-summary": "This special page shows the last uploaded files.",
        "newimages-legend": "Filter",
        "newimages-label": "Filename (or a part of it):",
+       "newimages-user": "IP address or username",
        "newimages-showbots": "Show uploads by bots",
        "newimages-hidepatrolled": "Hide patrolled uploads",
        "noimages": "Nothing to see.",
diff --combined languages/i18n/qqq.json
        "post-expand-template-argument-warning": "Used as warning in parser limitation.\n\nSee also:\n* {{msg-mw|Post-expand-template-argument-category}}",
        "post-expand-template-argument-category": "This message is used as a category name for a [[mw:Special:MyLanguage/Help:Tracking categories|tracking category]] where pages are placed automatically if they contain omitted template arguments.\n\nSee also:\n* {{msg-mw|Post-expand-template-argument-category-desc}}\n* {{msg-mw|Post-expand-template-argument-warning}}",
        "parser-template-loop-warning": "Parameters:\n* $1 - page title",
 +      "template-loop-category": "This message is used as a category name for a [[mw:Special:MyLanguage/Help:Tracking categories|tracking category]] where pages with template loops will be listed.",
 +      "template-loop-category-desc": "Pages with template loops category description. Shown on [[Special:TrackingCategories]].\n\nSee also:\n* {{msg-mw|Template-loop-category}}",
        "parser-template-recursion-depth-warning": "Parameters:\n* $1 - limit value of recursion depth",
        "language-converter-depth-warning": "Error message shown when a page uses too deeply nested language conversion syntax. Parameters:\n* $1 - the value of the depth limit",
        "node-count-exceeded-category": "This message is used as a category name for a [[mw:Help:Tracking categories|tracking category]] where pages are placed automatically if the node-count of the preprocessor exceeds the limit.\n\nSee also:\n* {{msg-mw|Node-count-exceeded-warning}}",
        "rcfilters-invalid-filter": "A label for an invalid filter.",
        "rcfilters-empty-filter": "Placeholder for the filter list when no filters were chosen.",
        "rcfilters-filterlist-title": "Title for the filters list.\n{{Identical|Filter}}",
 +      "rcfilters-filterlist-whatsthis": "Caption for the link that opens a popup with explanations about this filter group.",
        "rcfilters-filterlist-feedbacklink": "Caption for the link to the feedback page about the filters beta feature.",
        "rcfilters-highlightbutton-title": "Title for the highlight button used to toggle the highlight feature on and off.",
        "rcfilters-highlightmenu-title": "Title for the highlight menu used to select the highlight color for an individual filter.",
        "rcfilters-highlightmenu-help": "Tooltip for the highlight menu for individual filters.",
        "rcfilters-filterlist-noresults": "Message showing no results found for searching a filter.",
 +      "rcfilters-noresults-conflict": "A message displayed in the results area when no results found because there are filters in conflict with one another.",
 +      "rcfilters-state-message-subset": "Tooltip shown when hovering over a filter tag when one or more broader filters that contain the hovered filter are also selected. This indicates that the hovered filter has no effect because all the results it matches are also matched by the broader filter(s).  Parameters:\n* $1 - Comma-separated string of selected broader filters that this filter is a subset of\n* $2 - Count of filters in $1, for PLURAL",
 +      "rcfilters-state-message-fullcoverage": "Tooltip shown when hovering over a filter tag when all the filters in its group are selected. This indicates that the hovered filter has no effect because the selected filters in the group cover all changes. Parameters:\n* $1 - Comma-separated string of selected filters in the group\n* $2 - Count of filters in $1, for PLURAL",
        "rcfilters-filtergroup-registration": "Title for the filter group for editor registration type.",
        "rcfilters-filter-registered-label": "Label for the filter for showing edits made by logged-in users.\n{{Identical|Registered}}",
        "rcfilters-filter-registered-description": "Description for the filter for showing edits made by logged-in users.",
        "rcfilters-filter-categorization-description": "Description for the filter for showing edits adding or removing pages to categories.",
        "rcfilters-filter-logactions-label": "Label for the filter for showing logged actions.",
        "rcfilters-filter-logactions-description": "Description for the filter for showing logged actions.",
 +      "rcfilters-hideminor-conflicts-typeofchange-global": "The \"Minor edits\" filter is conflicting with one or more Type of Change filters, because certain types of change cannot be designated as \"minor.\" The conflicting filters are marked in the Active Filters area, above.\n\n\"Type of Change\" is {{msg-mw|Rcfilters-filtergroup-changetype}}.",
 +      "rcfilters-hideminor-conflicts-typeofchange": "Tooltip shown when hovering over the Minor edits tag, when a Type of Change filter is also selected.\n\n\"Minor edits\" is {{msg-mw|rcfilters-filter-minor-label}}.\n\n\"Type of change\" is {{msg-mw|rcfilters-filtergroup-changetype}}.\n\nThis indicates that no results will be shown.  Parameters:\n* $1 - Comma-separated string of selected Type of Change filters, e.g. \"Category, Logged Actions\"\n* $2 - Count of selected User Experience Level filters, for PLURAL",
 +      "rcfilters-typeofchange-conflicts-hideminor": "Tooltip shown when hovering over a Type of change filter tag, when the Minor edits filter is also selected.\n\n\"Minor edits\" is {{msg-mw|rcfilters-filter-minor-label}}.\n\n\"Type of change\" is {{msg-mw|rcfilters-filtergroup-changetype}}.\n\nThis indicates that no results will be shown.",
        "rcnotefrom": "This message is displayed at [[Special:RecentChanges]] when viewing recentchanges from some specific time.\n\nThe corresponding message is {{msg-mw|Rclistfrom}}.\n\nParameters:\n* $1 - the maximum number of changes that are displayed\n* $2 - (Optional) a date and time\n* $3 - a date\n* $4 - a time\n* $5 - Number of changes are displayed, for use with PLURAL",
        "rclistfrom": "Used on [[Special:RecentChanges]]. Parameters:\n* $1 - (Currently not use) date and time. The date and the time adds to the rclistfrom description.\n* $2 - time. The time adds to the rclistfrom link description (with split of date and time).\n* $3 - date. The date adds to the rclistfrom link description (with split of date and time).\n\nThe corresponding message is {{msg-mw|Rcnotefrom}}.",
        "rcshowhideminor": "Option text in [[Special:RecentChanges]]. Parameters:\n* $1 - the \"show/hide\" command, with the text taken from either {{msg-mw|rcshowhideminor-show}} or {{msg-mw|rcshowhideminor-hide}}\n{{Identical|Minor edit}}",
        "newimages-summary": "This message is displayed at the top of [[Special:NewImages]] to explain what is shown on that special page.",
        "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-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.",