generatePhpCharToUpperMappings: Die if fopen fails
[lhc/web/wiklou.git] / includes / api / ApiQueryAllUsers.php
index 59e92e1..a7d4fb9 100644 (file)
@@ -41,8 +41,6 @@ class ApiQueryAllUsers extends ApiQueryBase {
        }
 
        public function execute() {
-               global $wgActorTableSchemaMigrationStage;
-
                $params = $this->extractRequestParams();
                $activeUserDays = $this->getConfig()->get( 'ActiveUserDays' );
 
@@ -90,7 +88,8 @@ class ApiQueryAllUsers extends ApiQueryBase {
                if ( !is_null( $params['rights'] ) && count( $params['rights'] ) ) {
                        $groups = [];
                        foreach ( $params['rights'] as $r ) {
-                               $groups = array_merge( $groups, User::getGroupsWithPermission( $r ) );
+                               $groups = array_merge( $groups, $this->getPermissionManager()
+                                       ->getGroupsWithPermission( $r ) );
                        }
 
                        // no group with the given right(s) exists, no need for a query
@@ -180,22 +179,17 @@ class ApiQueryAllUsers extends ApiQueryBase {
                        ] ] );
 
                        // Actually count the actions using a subquery (T66505 and T66507)
-                       $tables = [ 'recentchanges' ];
-                       $joins = [];
-                       if ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_READ_OLD ) {
-                               $userCond = 'rc_user_text = user_name';
-                       } else {
-                               $tables[] = 'actor';
-                               $joins['actor'] = [ 'JOIN', 'rc_actor = actor_id' ];
-                               $userCond = 'actor_user = user_id';
-                       }
+                       $tables = [ 'recentchanges', 'actor' ];
+                       $joins = [
+                               'actor' => [ 'JOIN', 'rc_actor = actor_id' ],
+                       ];
                        $timestamp = $db->timestamp( wfTimestamp( TS_UNIX ) - $activeUserSeconds );
                        $this->addFields( [
                                'recentactions' => '(' . $db->selectSQLText(
                                        $tables,
                                        'COUNT(*)',
                                        [
-                                               $userCond,
+                                               'actor_user = user_id',
                                                'rc_type != ' . $db->addQuotes( RC_EXTERNAL ), // no wikidata
                                                'rc_log_type IS NULL OR rc_log_type != ' . $db->addQuotes( 'newusers' ),
                                                'rc_timestamp >= ' . $db->addQuotes( $timestamp ),
@@ -312,7 +306,7 @@ class ApiQueryAllUsers extends ApiQueryBase {
                                }
 
                                if ( $fld_rights ) {
-                                       $data['rights'] = User::getGroupPermissions( $groups );
+                                       $data['rights'] = $this->getPermissionManager()->getGroupPermissions( $groups );
                                        ApiResult::setIndexedTagName( $data['rights'], 'r' );
                                        ApiResult::setArrayType( $data['rights'], 'array' );
                                }
@@ -355,7 +349,7 @@ class ApiQueryAllUsers extends ApiQueryBase {
                                ApiBase::PARAM_ISMULTI => true,
                        ],
                        'rights' => [
-                               ApiBase::PARAM_TYPE => User::getAllRights(),
+                               ApiBase::PARAM_TYPE => $this->getPermissionManager()->getAllPermissions(),
                                ApiBase::PARAM_ISMULTI => true,
                        ],
                        'prop' => [