55 parent::__construct(
'Activeusers' );
72 $opts->add(
'username',
'' );
73 $opts->add(
'groups', [] );
74 $opts->add(
'excludegroups', [] );
79 $opts->fetchValuesFromRequest( $this->
getRequest() );
81 if ( $par !==
null ) {
82 $opts->setValue(
'username', $par );
88 $this->linkBatchFactory,
90 $this->userGroupManager,
93 $usersBody = $pager->getBody();
99 $pager->getNavigationBar() .
101 $pager->getNavigationBar()
103 $out->addModuleStyles(
'mediawiki.interface.helpers.styles' );
105 $out->addWikiMsg(
'activeusers-noresult' );
113 $groups = $this->userGroupManager->listAllGroups();
117 foreach ( $groups as $group ) {
118 $msg = htmlspecialchars(
$lang->getGroupName( $group ) );
119 $options[$msg] = $group;
125 $excludeDefault = [];
126 if ( $req->getCheck(
'hidebots' ) ) {
127 $excludeDefault[] =
'bot';
129 if ( $req->getCheck(
'hidesysops' ) ) {
130 $excludeDefault[] =
'sysop';
136 'name' =>
'username',
137 'label-message' =>
'activeusers-from',
140 'type' =>
'multiselect',
144 'label-message' =>
'activeusers-groups',
145 'options' => $options,
148 'type' =>
'multiselect',
151 'name' =>
'excludegroups',
152 'label-message' =>
'activeusers-excludegroups',
153 'options' => $options,
154 'default' => $excludeDefault,
160 ->setFormIdentifier(
'specialactiveusers' )
162 ->setWrapperLegendMsg(
'activeusers' )
163 ->setSubmitTextMsg(
'activeusers-submit' )
168 ->displayForm(
false );
176 $days = $this->
getConfig()->get( MainConfigNames::ActiveUserDays );
178 $intro = $this->
msg(
'activeusers-intro' )->numParams( $days )->parse();
182 $rcMax =
$dbr->selectField(
'recentchanges',
'MAX(rc_timestamp)',
'', __METHOD__ );
184 $cTime =
$dbr->selectField(
'querycache_info',
186 [
'qci_type' =>
'activeusers' ],
192 $rcMin =
$dbr->selectField(
'recentchanges',
'MIN(rc_timestamp)',
'', __METHOD__ );
193 $secondsOld = time() - (int)
wfTimestamp( TS_UNIX, $rcMin );
195 if ( $secondsOld > 0 ) {
196 $intro .= $this->
msg(
'cachedspecial-viewing-cached-ttl' )
197 ->durationParams( $secondsOld )->parseAsBlock();
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
A class containing constants representing the names of configuration variables.
Implements Special:Activeusers.
__construct(LinkBatchFactory $linkBatchFactory, ILoadBalancer $loadBalancer, UserGroupManager $userGroupManager)
LinkBatchFactory $linkBatchFactory
buildForm()
Generate and output the form.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getIntroText()
Return introductory message.
UserGroupManager $userGroupManager
ILoadBalancer $loadBalancer
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getRequest()
Get the WebRequest being used for this instance.
getPageTitle( $subpage=false)
Get a self-referential title object.
getLanguage()
Shortcut to get user's language.
if(!isset( $args[0])) $lang