X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryAllUsers.php;h=d594ad44a087e6db48135153029faf5ae0495f53;hb=53ecf20db8bfc2109553e80bf932dac7321d63ec;hp=2e2ac320fd589483e146a1160791f2881bd51f70;hpb=d114d34dac9fcc361fcd771e4c1e712d554e325c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryAllUsers.php b/includes/api/ApiQueryAllUsers.php index 2e2ac320fd..d594ad44a0 100644 --- a/includes/api/ApiQueryAllUsers.php +++ b/includes/api/ApiQueryAllUsers.php @@ -49,6 +49,7 @@ class ApiQueryAllUsers extends ApiQueryBase { $activeUserDays = $this->getConfig()->get( 'ActiveUserDays' ); $db = $this->getDB(); + $commentStore = new CommentStore( 'ipb_reason' ); $prop = $params['prop']; if ( !is_null( $prop ) ) { @@ -116,8 +117,16 @@ class ApiQueryAllUsers extends ApiQueryBase { // Filter only users that belong to a given group. This might // produce as many rows-per-user as there are groups being checked. $this->addTables( 'user_groups', 'ug1' ); - $this->addJoinConds( [ 'ug1' => [ 'INNER JOIN', [ 'ug1.ug_user=user_id', - 'ug1.ug_group' => $params['group'] ] ] ] ); + $this->addJoinConds( [ + 'ug1' => [ + 'INNER JOIN', + [ + 'ug1.ug_user=user_id', + 'ug1.ug_group' => $params['group'], + 'ug1.ug_expiry IS NULL OR ug1.ug_expiry >= ' . $db->addQuotes( $db->timestamp() ) + ] + ] + ] ); $maxDuplicateRows *= count( $params['group'] ); } @@ -135,7 +144,10 @@ class ApiQueryAllUsers extends ApiQueryBase { ) ]; } $this->addJoinConds( [ 'ug1' => [ 'LEFT OUTER JOIN', - array_merge( [ 'ug1.ug_user=user_id' ], $exclude ) + array_merge( [ + 'ug1.ug_user=user_id', + 'ug1.ug_expiry IS NULL OR ug1.ug_expiry >= ' . $db->addQuotes( $db->timestamp() ) + ], $exclude ) ] ] ); $this->addWhere( 'ug1.ug_user IS NULL' ); } @@ -148,7 +160,10 @@ class ApiQueryAllUsers extends ApiQueryBase { if ( $fld_groups || $fld_rights ) { $this->addFields( [ 'groups' => - $db->buildGroupConcatField( '|', 'user_groups', 'ug_group', 'ug_user=user_id' ) + $db->buildGroupConcatField( '|', 'user_groups', 'ug_group', [ + 'ug_user=user_id', + 'ug_expiry IS NULL OR ug_expiry >= ' . $db->addQuotes( $db->timestamp() ) + ] ) ] ); } @@ -166,7 +181,7 @@ class ApiQueryAllUsers extends ApiQueryBase { ], ] ] ); - // Actually count the actions using a subquery (bug 64505 and bug 64507) + // Actually count the actions using a subquery (T66505 and T66507) $timestamp = $db->timestamp( wfTimestamp( TS_UNIX ) - $activeUserSeconds ); $this->addFields( [ 'recentactions' => '(' . $db->selectSQLText( @@ -249,7 +264,7 @@ class ApiQueryAllUsers extends ApiQueryBase { $data['blockedby'] = $row->ipb_by_text; $data['blockedbyid'] = (int)$row->ipb_by; $data['blockedtimestamp'] = wfTimestamp( TS_ISO_8601, $row->ipb_timestamp ); - $data['blockreason'] = $row->ipb_reason; + $data['blockreason'] = $commentStore->getComment( $row )->text; $data['blockexpiry'] = $row->ipb_expiry; } if ( $row->ipb_deleted ) { @@ -375,6 +390,6 @@ class ApiQueryAllUsers extends ApiQueryBase { } public function getHelpUrls() { - return 'https://www.mediawiki.org/wiki/API:Allusers'; + return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Allusers'; } }