Merge "Add parameter to API modules to apply change tags to log entries"
[lhc/web/wiklou.git] / includes / specials / pagers / ActiveUsersPager.php
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 ]