58 parent::__construct(
'Activeusers' );
59 $this->linkBatchFactory = $linkBatchFactory;
60 $this->dbProvider = $dbProvider;
61 $this->userGroupManager = $userGroupManager;
62 $this->userIdentityLookup = $userIdentityLookup;
63 $this->hideUserUtils = $hideUserUtils;
64 $this->tempUserConfig = $tempUserConfig;
78 $opts->add(
'username',
'' );
79 $opts->add(
'groups', [] );
80 $opts->add(
'excludegroups', [] );
82 $opts->add(
'hidebots',
false, FormOptions::BOOL );
83 $opts->add(
'hidesysops',
false, FormOptions::BOOL );
85 $opts->fetchValuesFromRequest( $this->
getRequest() );
87 if ( $par !==
null ) {
88 $opts->setValue(
'username', $par );
94 $this->linkBatchFactory,
96 $this->userGroupManager,
97 $this->userIdentityLookup,
99 $this->tempUserConfig,
102 $usersBody = $pager->getBody();
108 $pager->getNavigationBar() .
109 Html::rawElement(
'ul', [], $usersBody ) .
110 $pager->getNavigationBar()
112 $out->addModuleStyles(
'mediawiki.interface.helpers.styles' );
114 $out->addWikiMsg(
'activeusers-noresult' );
122 $groups = $this->userGroupManager->listAllGroups();
126 foreach ( $groups as $group ) {
127 $msg = htmlspecialchars( $lang->getGroupName( $group ) );
128 $options[$msg] = $group;
134 $excludeDefault = [];
135 if ( $req->getCheck(
'hidebots' ) ) {
136 $excludeDefault[] =
'bot';
138 if ( $req->getCheck(
'hidesysops' ) ) {
139 $excludeDefault[] =
'sysop';
145 'name' =>
'username',
146 'label-message' =>
'activeusers-from',
149 'type' =>
'multiselect',
153 'label-message' =>
'activeusers-groups',
154 'options' => $options,
157 'type' =>
'multiselect',
160 'name' =>
'excludegroups',
161 'label-message' =>
'activeusers-excludegroups',
162 'options' => $options,
163 'default' => $excludeDefault,
167 HTMLForm::factory(
'ooui', $formDescriptor, $this->
getContext() )
169 ->setFormIdentifier(
'specialactiveusers' )
171 ->setWrapperLegendMsg(
'activeusers' )
172 ->setSubmitTextMsg(
'activeusers-submit' )
177 ->displayForm(
false );
187 $intro = $this->
msg(
'activeusers-intro' )->numParams( $days )->parse();
190 $dbr = $this->dbProvider->getReplicaDatabase();
192 $rcMax = $dbr->newSelectQueryBuilder()
193 ->select(
'MAX(rc_timestamp)' )
194 ->from(
'recentchanges' )
195 ->caller( __METHOD__ )->fetchField();
197 $cTime = $dbr->newSelectQueryBuilder()
198 ->select(
'qci_timestamp' )
199 ->from(
'querycache_info' )
200 ->where( [
'qci_type' =>
'activeusers' ] )
201 ->caller( __METHOD__ )->fetchField();
205 $rcMin = $dbr->newSelectQueryBuilder()
206 ->select(
'MIN(rc_timestamp)' )
207 ->from(
'recentchanges' )
208 ->caller( __METHOD__ )->fetchField();
209 $secondsOld = time() - (int)
wfTimestamp( TS_UNIX, $rcMin );
211 if ( $secondsOld > 0 ) {
212 $intro .= $this->
msg(
'cachedspecial-viewing-cached-ttl' )
213 ->durationParams( $secondsOld )->parseAsBlock();
226class_alias( SpecialActiveUsers::class,
'SpecialActiveUsers' );
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
A class containing constants representing the names of configuration variables.
const ActiveUserDays
Name constant for the ActiveUserDays setting, for use with Config::get()
Parent class for all special pages.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getPageTitle( $subpage=false)
Get a self-referential title object.
getConfig()
Shortcut to get main config object.
getContext()
Gets the context this SpecialPage is executed in.
getRequest()
Get the WebRequest being used for this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
getLanguage()
Shortcut to get user's language.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages By default the message key is the canonical name of...