53 private $blockStatusByUid;
59 private $excludegroups;
90 $this->RCMaxAge = $this->
getConfig()->get( MainConfigNames::ActiveUserDays );
91 $this->requestedUser =
'';
96 if ( $username !==
null ) {
97 $this->requestedUser = $username->getText();
105 $this->excludegroups[] =
'bot';
108 $this->excludegroups[] =
'sysop';
119 $activeUserSeconds = $this->
getConfig()->get( MainConfigNames::ActiveUserDays ) * 86400;
120 $timestamp =
$dbr->timestamp( (
int)
wfTimestamp( TS_UNIX ) - $activeUserSeconds );
124 $tables = [
'querycachetwo',
'user',
'actor' ];
125 $fields = [
'qcc_title',
'user_id',
'actor_id' ];
127 'user' => [
'JOIN',
'user_name = qcc_title' ],
128 'actor' => [
'JOIN',
'actor_user = user_id' ],
131 'qcc_type' =>
'activeusers',
135 if ( $data !==
null ) {
136 $options[
'ORDER BY'] =
'qcc_title ' . $data[
'order'];
137 $options[
'LIMIT'] = $data[
'limit'];
138 $conds = array_merge( $conds, $data[
'conds'] );
140 if ( $this->requestedUser !=
'' ) {
141 $conds[] =
'qcc_title >= ' .
$dbr->addQuotes( $this->requestedUser );
143 if ( $this->groups !== [] ) {
144 $tables[
'ug1'] =
'user_groups';
145 $jconds[
'ug1'] = [
'JOIN',
'ug1.ug_user = user_id' ];
147 $conds[] =
'ug1.ug_expiry IS NULL OR ug1.ug_expiry >= ' .
$dbr->addQuotes(
$dbr->timestamp() );
149 if ( $this->excludegroups !== [] ) {
150 $tables[
'ug2'] =
'user_groups';
151 $jconds[
'ug2'] = [
'LEFT JOIN', [
152 'ug2.ug_user = user_id',
153 'ug2.ug_group' => $this->excludegroups,
154 'ug2.ug_expiry IS NULL OR ug2.ug_expiry >= ' .
$dbr->addQuotes(
$dbr->timestamp() ),
156 $conds[
'ug2.ug_user'] =
null;
159 $conds[] =
'NOT EXISTS (' .
$dbr->selectSQLText(
160 'ipblocks',
'1', [
'ipb_user=user_id',
'ipb_deleted' => 1 ], __METHOD__
163 $subquery =
$dbr->buildSelectSubquery( $tables, $fields, $conds, $fname, $options, $jconds );
166 $tables = [
'qcc_users' => $subquery,
'recentchanges' ];
167 $jconds = [
'recentchanges' => [
'LEFT JOIN', [
168 'rc_actor = actor_id',
171 'rc_log_type IS NULL OR rc_log_type != ' .
$dbr->addQuotes(
'newusers' ),
172 'rc_timestamp >= ' .
$dbr->addQuotes( $timestamp ),
180 'user_name' =>
'qcc_title',
181 'user_id' =>
'user_id',
182 'recentedits' =>
'COUNT(rc_id)'
184 'options' => [
'GROUP BY' => [
'qcc_title',
'user_id' ] ],
186 'join_conds' => $jconds,
193 $sortColumns = array_merge( [ $this->mIndexField ], $this->mExtraSortFields );
194 if ( $order === self::QUERY_ASCENDING ) {
196 $orderBy = $sortColumns;
197 $operator = $this->mIncludeOffset ?
'>=' :
'>';
201 foreach ( $sortColumns as $col ) {
202 $orderBy[] = $col .
' DESC';
204 $operator = $this->mIncludeOffset ?
'<=' :
'<';
207 'limit' => intval( $limit ),
210 $offset !=
'' ? [ $this->mIndexField . $operator . $this->
getDatabase()->addQuotes( $offset ) ] : [],
213 $tables = $info[
'tables'];
214 $fields = $info[
'fields'];
215 $conds = $info[
'conds'];
216 $options = $info[
'options'];
217 $join_conds = $info[
'join_conds'];
218 $options[
'ORDER BY'] = $orderBy;
219 return [ $tables, $fields, $conds, $fname, $options, $join_conds ];
223 parent::doBatchLookups();
226 foreach ( $this->mResult as $row ) {
227 $uids[] = $row->user_id;
235 [
'ipb_user',
'deleted' =>
'MAX(ipb_deleted)',
'sitewide' =>
'MAX(ipb_sitewide)' ],
236 [
'ipb_user' => $uids ],
238 [
'GROUP BY' => [
'ipb_user' ] ]
240 $this->blockStatusByUid = [];
241 foreach (
$res as $row ) {
242 $this->blockStatusByUid[$row->ipb_user] = [
243 'deleted' => $row->deleted,
244 'sitewide' => $row->sitewide,
247 $this->mResult->seek( 0 );
251 $userName = $row->user_name;
253 $ulinks = Linker::userLink( $row->user_id, $userName );
254 $ulinks .= Linker::userToolLinks(
273 foreach ( $ugms as $ugm ) {
284 $isBlocked = isset( $this->blockStatusByUid[$row->user_id] );
286 if ( $this->blockStatusByUid[$row->user_id][
'deleted'] == 1 ) {
287 $item =
"<span class=\"deleted\">$item</span>";
289 if ( $this->blockStatusByUid[$row->user_id][
'sitewide'] == 1 ) {
290 $blocked =
' ' . $this->
msg(
'listusers-blocked', $userName )->escaped();
293 $count = $this->
msg(
'activeusers-count' )->numParams( $row->recentedits )
294 ->params( $userName )->numParams( $this->RCMaxAge )->escaped();
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
A class containing constants representing the names of configuration variables.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Interface for objects which can provide a MediaWiki context on request.
if(!isset( $args[0])) $lang