Go to the documentation of this file.
60 $this->RCMaxAge = $wgActiveUserDays;
61 $un = $this->
getRequest()->getText(
'username', $par );
62 $this->requestedUser =
'';
65 if ( !is_null( $username ) ) {
66 $this->requestedUser = $username->getText();
79 $this->opts->fetchValuesFromRequest( $this->
getRequest() );
81 if ( $this->opts->getValue(
'hidebots' ) == 1 ) {
82 $this->hideRights[] =
'bot';
84 if ( $this->opts->getValue(
'hidesysops' ) == 1 ) {
85 $this->hideGroups[] =
'sysop';
97 'qcc_type' =>
'activeusers',
99 'user_name = qcc_title',
100 'rc_user_text = qcc_title',
103 if ( $this->requestedUser !=
'' ) {
104 $conds[] =
'qcc_title >= ' .
$dbr->addQuotes( $this->requestedUser );
106 if ( !$this->
getUser()->isAllowed(
'hideuser' ) ) {
107 $conds[] =
'NOT EXISTS (' .
$dbr->selectSQLText(
108 'ipblocks',
'1',
array(
'ipb_user=user_id',
'ipb_deleted' => 1 )
112 if (
$dbr->implicitGroupby() ) {
119 'tables' =>
array(
'querycachetwo',
'user',
'recentchanges' ),
120 'fields' =>
array(
'user_name',
'user_id',
'recentedits' =>
'COUNT(*)',
'qcc_title' ),
128 foreach ( $this->mResult
as $row ) {
129 $uids[] = $row->user_id;
137 array(
'ipb_user',
'MAX(ipb_deleted) AS block_status' ),
138 array(
'ipb_user' => $uids ),
142 $this->blockStatusByUid =
array();
143 foreach (
$res as $row ) {
144 $this->blockStatusByUid[$row->ipb_user] = $row->block_status;
146 $this->mResult->seek( 0 );
150 $userName = $row->user_name;
161 foreach ( $this->hideRights
as $right ) {
175 foreach (
$user->getGroups()
as $group ) {
176 if ( in_array( $group, $this->hideGroups ) ) {
182 $groups = $lang->commaList( $list );
184 $item = $lang->specialList( $ulinks, $groups );
186 $isBlocked = isset( $this->blockStatusByUid[$row->user_id] );
187 if ( $isBlocked && $this->blockStatusByUid[$row->user_id] == 1 ) {
188 $item =
"<span class=\"deleted\">$item</span>";
190 $count = $this->
msg(
'activeusers-count' )->numParams( $row->recentedits )
191 ->params( $userName )->numParams( $this->RCMaxAge )->escaped();
192 $blocked = $isBlocked ?
' ' . $this->
msg(
'listusers-blocked', $userName )->escaped() :
'';
208 'username',
'offset', 20, $this->requestedUser,
array(
'tabindex' => 1 ) ) .
'<br />';# Username field
211 'hidebots',
'hidebots', $this->opts->getValue(
'hidebots' ),
array(
'tabindex' => 2 ) );
214 'hidesysops',
'hidesysops', $this->opts->getValue(
'hidesysops' ),
array(
'tabindex' => 3 ) ) .
'<br />';
233 parent::__construct(
'Activeusers' );
241 public function execute( $par ) {
248 $out->wrapWikiMsg(
"<div class='mw-activeusers-intro'>\n$1\n</div>",
249 array(
'activeusers-intro', $this->
getLanguage()->formatNum( $wgActiveUserDays ) ) );
252 $seconds = min( self::mergeActiveUsers( 600 ), $wgActiveUserDays * 86400 );
254 $out->addWikiMsg(
'cachedspecial-viewing-cached-ttl',
255 $this->
getLanguage()->formatDuration( $seconds ) );
259 # getBody() first to check, if empty
260 $usersbody = $up->getBody();
262 $out->addHTML( $up->getPageHeader() );
265 $up->getNavigationBar() .
267 $up->getNavigationBar()
270 $out->addWikiMsg(
'activeusers-noresult' );
286 $cTime =
$dbr->selectField(
'querycache_info',
288 array(
'qci_type' =>
'activeusers' )
293 if ( $dbw->estimateRowCount(
'recentchanges' ) <= 10000 ) {
294 $window = $wgActiveUserDays * 86400;
296 $window = $period * 2;
326 $lockKey =
wfWikiID() .
'-activeusers';
327 if ( !$dbw->
lock( $lockKey, __METHOD__, 1 ) ) {
334 array(
'qci_type' =>
'activeusers' )
341 $sTimestamp = max( $cTimeUnix, $now - $wgActiveUserDays * 86400 );
342 $eTimestamp = min( $sTimestamp + $window, $now );
346 array(
'recentchanges' ),
347 array(
'rc_user_text',
'lastedittime' =>
'MAX(rc_timestamp)' ),
351 'rc_log_type IS NULL OR rc_log_type != ' . $dbw->
addQuotes(
'newusers' ),
357 'GROUP BY' =>
array(
'rc_user_text' ),
362 foreach (
$res as $row ) {
363 $names[$row->rc_user_text] = $row->lastedittime;
367 $dbw->
delete(
'querycachetwo',
369 'qcc_type' =>
'activeusers',
370 'qcc_value < ' . $dbw->
addQuotes( $now - $wgActiveUserDays * 86400 )
376 if ( count( $names ) ) {
378 array(
'user_name' =>
'qcc_title' ),
380 'qcc_type' =>
'activeusers',
382 'qcc_title' => array_keys( $names ) ),
385 foreach (
$res as $row ) {
386 unset( $names[$row->user_name] );
391 if ( count( $names ) ) {
393 foreach ( $names
as $name => $lastEditTime ) {
395 'qcc_type' =>
'activeusers',
397 'qcc_title' =>
$name,
399 'qcc_namespacetwo' => 0,
403 foreach ( array_chunk( $newRows, 500 )
as $rowBatch ) {
404 $dbw->
insert(
'querycachetwo', $rowBatch, __METHOD__ );
410 $dbw->
replace(
'querycache_info',
412 array(
'qci_type' =>
'activeusers',
413 'qci_timestamp' => $dbw->
timestamp( $eTimestamp ) ),
417 $dbw->
unlock( $lockKey, __METHOD__ );
static checkLabel( $label, $name, $id, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox with a label.
replace( $table, $uniqueIndexes, $rows, $fname=__METHOD__)
REPLACE query wrapper.
static newFromId( $id)
Static factory method for creation from a given user ID.
execute( $par)
Show the special page.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
static cacheUpdate(DatabaseBase $dbw)
msg()
Get a Message object with context set Parameters are the same as wfMessage()
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
getOutput()
Get the OutputPage being used for this instance.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
return false if a UserGetRights hook might remove the named right $right
wfReadOnly()
Check whether the wiki is in read-only mode.
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
__construct()
Constructor.
getRequest()
Get the WebRequest object.
getLanguage()
Shortcut to get user's language.
getUser()
Get the User object.
getTitle()
Get the Title object.
timestamp( $ts=0)
Convert a timestamp in one of the formats accepted by wfTimestamp() to the format used for inserting ...
static openElement( $element, $attribs=null)
This opens an XML element.
static mergeActiveUsers( $period)
getLanguage()
Get the Language object.
addQuotes( $s)
Adds quotes and backslashes.
selectField( $table, $var, $cond='', $fname=__METHOD__, $options=array())
A SELECT wrapper which returns a single field from a single result row.
unlock( $lockName, $method)
Release a lock.
select( $table, $vars, $conds='', $fname=__METHOD__, $options=array(), $join_conds=array())
Execute a SELECT query constructed using the various parameters provided.
static doQueryCacheUpdate(DatabaseBase $dbw, $window)
Update the query cache as needed.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
static inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML text input field with a label.
when a variable name is used in a it is silently declared as a new masking the global
null means default in associative array form
wfWaitForSlaves( $maxLag=false, $wiki=false, $cluster=false)
Modern version of wfWaitForSlaves().
getContext()
Gets the context this SpecialPage is executed in.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
Allows to change the fields on the form that will be generated $name
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
Generate standard user tool links (talk, contributions, block link, etc.)
Parent class for all special pages.
Database abstraction object.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Interface for objects which can provide a context on request.
lock( $lockName, $method, $timeout=5)
Acquire a named lock.
static closeElement( $element)
Shortcut to close an XML element.
delete( $table, $conds, $fname=__METHOD__)
DELETE query wrapper.
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
static fieldset( $legend=false, $content=false, $attribs=array())
Shortcut for creating fieldsets.
insert( $table, $a, $fname=__METHOD__, $options=array())
INSERT wrapper, inserts an array into a table.