Merge ".mailmap, CREDITS: Correct Alexandre Emsenhuber's (IAlex) name"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 21 Nov 2016 20:43:41 +0000 (20:43 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 21 Nov 2016 20:43:41 +0000 (20:43 +0000)
includes/specials/SpecialActiveusers.php
includes/specials/pagers/ActiveUsersPager.php
languages/i18n/en.json
languages/i18n/qqq.json
tests/phpunit/tests/MediaWikiTestCaseTest.php

index 531c330..7e29be0 100644 (file)
@@ -52,6 +52,10 @@ class SpecialActiveUsers extends SpecialPage {
 
                $opts->add( 'username', '' );
                $opts->add( 'groups', [] );
+               $opts->add( 'excludegroups', [] );
+               // Backwards-compatibility with old URLs
+               $opts->add( 'hidebots', false, FormOptions::BOOL );
+               $opts->add( 'hidesysops', false, FormOptions::BOOL );
 
                $opts->fetchValuesFromRequest( $this->getRequest() );
 
@@ -86,13 +90,22 @@ class SpecialActiveUsers extends SpecialPage {
                        $options[$msg] = $group;
                }
 
+               // Backwards-compatibility with old URLs
+               $req = $this->getRequest();
+               $excludeDefault = [];
+               if ( $req->getCheck( 'hidebots' ) ) {
+                       $excludeDefault[] = 'bot';
+               }
+               if ( $req->getCheck( 'hidesysops' ) ) {
+                       $excludeDefault[] = 'sysop';
+               }
+
                $formDescriptor = [
                        'username' => [
                                'type' => 'user',
                                'name' => 'username',
                                'label-message' => 'activeusers-from',
                        ],
-
                        'groups' => [
                                'type' => 'multiselect',
                                'dropdown' => true,
@@ -101,6 +114,15 @@ class SpecialActiveUsers extends SpecialPage {
                                'label-message' => 'activeusers-groups',
                                'options' => $options,
                        ],
+                       'excludegroups' => [
+                               'type' => 'multiselect',
+                               'dropdown' => true,
+                               'flatlist' => true,
+                               'name' => 'excludegroups',
+                               'label-message' => 'activeusers-excludegroups',
+                               'options' => $options,
+                               'default' => $excludeDefault,
+                       ],
                ];
 
                HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() )
index ea906b7..645a115 100644 (file)
@@ -64,6 +64,14 @@ class ActiveUsersPager extends UsersPager {
                }
 
                $this->groups = $opts->getValue( 'groups' );
+               $this->excludegroups = $opts->getValue( 'excludegroups' );
+               // Backwards-compatibility with old URLs
+               if ( $opts->getValue( 'hidebots' ) ) {
+                       $this->excludegroups[] = 'bot';
+               }
+               if ( $opts->getValue( 'hidesysops' ) ) {
+                       $this->excludegroups[] = 'sysop';
+               }
        }
 
        function getIndexField() {
@@ -94,6 +102,13 @@ class ActiveUsersPager extends UsersPager {
                        $conds[] = 'ug_user = user_id';
                        $conds['ug_group'] = $this->groups;
                }
+               if ( $this->excludegroups !== [] ) {
+                       foreach ( $this->excludegroups as $group ) {
+                               $conds[] = 'NOT EXISTS (' . $dbr->selectSQLText(
+                                               'user_groups', '1', [ 'ug_user = user_id', 'ug_group' => $group ]
+                                       ) . ')';
+                       }
+               }
                if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
                        $conds[] = 'NOT EXISTS (' . $dbr->selectSQLText(
                                        'ipblocks', '1', [ 'ipb_user=user_id', 'ipb_deleted' => 1 ]
index 719f304..28ccbf3 100644 (file)
        "activeusers-count": "$1 {{PLURAL:$1|action|actions}} in the last {{PLURAL:$3|day|$3 days}}",
        "activeusers-from": "Display users starting at:",
        "activeusers-groups": "Display users belonging to groups:",
+       "activeusers-excludegroups": "Exclude users belonging to groups:",
        "activeusers-noresult": "No users found.",
        "activeusers-submit": "Display active users",
        "listgrouprights": "User group rights",
index 07b55f9..e1b6c9b 100644 (file)
        "activeusers-count": "Used in [[Special:ActiveUsers]] to show the active user's recent action count in brackets ([]).\n* $1 is the number of recent actions\n* $2 is the user's name for use with GENDER (optional)\n* $3 is the maximum number of days of the RecentChangesList",
        "activeusers-from": "Used as label for checkbox in the form on [[Special:ActiveUsers]].\n\nidentical with {{msg-mw|listusersfrom}}\n\nSee also:\n* {{msg-mw|activeusers|legend for the form}}",
        "activeusers-groups": "Used as label on [[Special:ActiveUsers]].",
+       "activeusers-excludegroups": "Used as an option on [[Special:ActiveUsers]].",
        "activeusers-noresult": "identical with {{msg-mw|listusers-noresult}}",
        "activeusers-submit": "Used as label for button in the form on [[Special:ActiveUsers]]",
        "listgrouprights": "The name of the special page [[Special:ListGroupRights]].",
index a2ef35f..1c64485 100644 (file)
@@ -9,8 +9,6 @@ use Psr\Log\LoggerInterface;
  */
 class MediaWikiTestCaseTest extends MediaWikiTestCase {
 
-       const GLOBAL_KEY_NONEXISTING = 'MediaWikiTestCaseTestGLOBAL-NONExisting';
-
        private static $startGlobals = [
                'MediaWikiTestCaseTestGLOBAL-ExistingString' => 'foo',
                'MediaWikiTestCaseTestGLOBAL-ExistingStringEmpty' => '',