Go to the documentation of this file.
35 parent::__construct(
'Statistics' );
42 $this->
getOutput()->addModuleStyles(
'mediawiki.special' );
55 if ( !$wgDisableCounters ) {
59 # Set active user count
60 if ( !$wgMiserMode ) {
61 $key =
wfMemcKey(
'sitestats',
'activeusers-updated' );
66 $wgMemc->set( $key,
'1', 24 * 3600 );
81 # Statistic - usergroups
85 # Statistic - popular pages
86 if ( !$wgDisableCounters && !$wgMiserMode ) {
91 $extraStats =
array();
99 $footer = $this->
msg(
'statistics-footer' );
100 if ( !$footer->isBlank() ) {
101 $text .=
"\n" . $footer->parse();
117 $descMsg =
'', $descMsgParam =
''
120 $msg = $this->
msg( $descMsg, $descMsgParam );
121 if ( $msg->exists() ) {
122 $descriptionText = $this->
msg(
'parentheses' )->rawParams( $msg->parse() )->escaped();
123 $text .=
"<br />" .
Xml::element(
'small',
array(
'class' =>
'mw-statistic-desc' ),
124 " $descriptionText" );
141 Xml::tags(
'th',
array(
'colspan' =>
'2' ), $this->
msg(
'statistics-header-pages' )->parse() ) .
144 $this->
msg(
'statistics-articles' )->parse() ),
146 array(
'class' =>
'mw-statistics-articles' ) ) .
147 $this->
formatRow( $this->
msg(
'statistics-pages' )->parse(),
149 array(
'class' =>
'mw-statistics-pages' ),
150 'statistics-pages-desc' ) .
152 $this->
msg(
'statistics-files' )->parse() ),
154 array(
'class' =>
'mw-statistics-files' ) );
159 Xml::tags(
'th',
array(
'colspan' =>
'2' ), $this->
msg(
'statistics-header-edits' )->parse() ) .
161 $this->
formatRow( $this->
msg(
'statistics-edits' )->parse(),
163 array(
'class' =>
'mw-statistics-edits' )
165 $this->
formatRow( $this->
msg(
'statistics-edits-average' )->parse(),
167 ->formatNum( sprintf(
'%.2f', $this->total ? $this->
edits / $this->total : 0 ) ),
168 array(
'class' =>
'mw-statistics-edits-average' )
176 Xml::tags(
'th',
array(
'colspan' =>
'2' ), $this->
msg(
'statistics-header-users' )->parse() ) .
178 $this->
formatRow( $this->
msg(
'statistics-users' )->parse(),
180 array(
'class' =>
'mw-statistics-users' )
182 $this->
formatRow( $this->
msg(
'statistics-users-active' )->parse() .
' ' .
185 $this->
msg(
'listgrouprights-members' )->escaped()
187 $this->
getLanguage()->formatNum( $this->activeUsers ),
188 array(
'class' =>
'mw-statistics-users-active' ),
189 'statistics-users-active-desc',
190 $this->
getLanguage()->formatNum( $wgActiveUserDays )
195 global $wgGroupPermissions, $wgImplicitGroups;
197 foreach ( $wgGroupPermissions
as $group => $permissions ) {
198 # Skip generic * and implicit groups
199 if ( in_array( $group, $wgImplicitGroups ) || $group ==
'*' ) {
202 $groupname = htmlspecialchars( $group );
203 $msg = $this->
msg(
'group-' . $groupname );
204 if ( $msg->isBlank() ) {
205 $groupnameLocalized = $groupname;
207 $groupnameLocalized = $msg->text();
209 $msg = $this->
msg(
'grouppage-' . $groupname )->inContentLanguage();
210 if ( $msg->isBlank() ) {
213 $grouppageLocalized = $msg->text();
218 htmlspecialchars( $groupnameLocalized )
222 $this->
msg(
'listgrouprights-members' )->escaped(),
224 array(
'group' => $group )
226 # Add a class when a usergroup contains no members to allow hiding these rows
229 if ( $countUsers == 0 ) {
230 $classZero =
' statistics-group-zero';
232 $text .= $this->
formatRow( $grouppage .
' ' . $grouplink,
242 Xml::tags(
'th',
array(
'colspan' =>
'2' ), $this->
msg(
'statistics-header-views' )->parse() ) .
244 $this->
formatRow( $this->
msg(
'statistics-views-total' )->parse(),
246 array(
'class' =>
'mw-statistics-views-total' ),
'statistics-views-total-desc' ) .
247 $this->
formatRow( $this->
msg(
'statistics-views-peredit' )->parse(),
249 $this->views / $this->
edits : 0 ) ),
250 array(
'class' =>
'mw-statistics-views-peredit' ) );
264 'page_is_redirect' => 0,
269 'ORDER BY' =>
'page_counter DESC',
274 if (
$res->numRows() > 0 ) {
278 array(
'colspan' =>
'2' ),
279 $this->
msg(
'statistics-mostpopular' )->parse()
283 foreach (
$res as $row ) {
288 $this->
getLanguage()->formatNum( $row->page_counter ) );
307 foreach ( $stats
as $header => $items ) {
309 if ( is_array( $items ) ) {
312 if ( $header !==
'statistics-header-hooks' ) {
317 foreach ( $items
as $key =>
$value ) {
318 $name = $this->
msg( $key )->parse();
319 $number = htmlspecialchars(
$value );
324 array(
'class' =>
'mw-statistics-hook',
'id' =>
'mw-' . $key )
329 if ( $return ===
'' ) {
335 array( $header => $items ) ) );
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
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
formatRow( $text, $number, $trExtraParams=array(), $descMsg='', $descMsgParam='')
Format a row.
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
getOutput()
Get the OutputPage being used for this instance.
static cacheUpdate( $dbw)
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Special page lists various statistics, including the contents of site_stats, plus page view details i...
static numberingroup( $group)
Find the number of users in a given user group.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
static escapeClass( $class)
Given a value, escape it so that it can be used as a CSS class and return it.
getLanguage()
Shortcut to get user's language.
static openElement( $element, $attribs=null)
This opens an XML element.
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of or an object and a method hook function The function part of a hook
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global then executing the whole list after the page is displayed We don t do anything smart like collating updates to the same table or such because the list is almost always going to have just one item on if so it s not worth the trouble Since there is a job queue in the jobs which is used to update link tables of transcluding pages after edits
wfMemcKey()
Get a cache key.
execute( $par)
Default execute method Checks user permissions, calls the function given in mFunction.
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
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!
when a variable name is used in a it is silently declared as a new masking the global
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
presenting them properly to the user as errors is done by the caller $title
Allows to change the fields on the form that will be generated $name
msg()
Wrapper around wfMessage that sets the current context.
Parent class for all special pages.
Represents a title within MediaWiki.
static closeElement( $element)
Shortcut to close an XML element.
formatRowHeader( $header)
Format row header.
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
getPageStats()
Each of these methods is pretty self-explanatory, get a particular row for the table of statistics.
getOtherStats(array $stats)
Conversion of external statistics into an internal representation Following a ([<header-message>][<it...
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
static getCanonicalName( $index)
Returns the canonical (English) name for a given index.