35 parent::__construct(
'Statistics' );
40 $this->
getOutput()->addModuleStyles(
'mediawiki.special' );
50 $text = Xml::openElement(
'table', [
'class' =>
'wikitable mw-statistics-table' ] );
61 # Statistic - usergroups
66 if ( Hooks::run(
'SpecialStatsAddExtra', [ &$extraStats, $this->
getContext() ] ) ) {
70 $text .= Xml::closeElement(
'table' );
75 $text .=
"\n" .
$footer->parse();
90 private function formatRow( $text, $number, $trExtraParams = [],
91 $descMsg =
'', $descMsgParam =
''
94 $msg = $this->
msg( $descMsg, $descMsgParam );
95 if ( !$msg->isDisabled() ) {
96 $descriptionHtml = $this->
msg(
'parentheses' )->rawParams( $msg->parse() )
98 $text .=
"<br />" . Html::rawElement(
100 [
'class' =>
'mw-statistic-desc' ],
106 return Html::rawElement(
'tr', $trExtraParams,
107 Html::rawElement(
'td', [], $text ) .
108 Html::rawElement(
'td', [
'class' =>
'mw-statistics-numbers' ], $number )
121 $pageStatsHtml = Xml::openElement(
'tr' ) .
122 Xml::tags(
'th', [
'colspan' =>
'2' ], $this->
msg(
'statistics-header-pages' )
124 Xml::closeElement(
'tr' ) .
126 $specialAllPagesTitle,
127 $this->msg(
'statistics-articles' )->text(),
128 [], [
'hideredirects' => 1 ] ),
129 $this->getLanguage()->formatNum( $this->good ),
130 [
'class' =>
'mw-statistics-articles' ],
131 'statistics-articles-desc' ) .
133 $this->msg(
'statistics-pages' )->text() ),
134 $this->getLanguage()->formatNum( $this->total ),
135 [
'class' =>
'mw-statistics-pages' ],
136 'statistics-pages-desc' );
139 if ( $this->images !== 0 || $this->
getConfig()->
get(
'EnableUploads' ) ) {
142 $this->msg(
'statistics-files' )->text() ),
143 $this->getLanguage()->formatNum( $this->images ),
144 [
'class' =>
'mw-statistics-files' ] );
151 return Xml::openElement(
'tr' ) .
152 Xml::tags(
'th', [
'colspan' =>
'2' ],
153 $this->
msg(
'statistics-header-edits' )->parse() ) .
154 Xml::closeElement(
'tr' ) .
155 $this->
formatRow( $this->
msg(
'statistics-edits' )->parse(),
157 [
'class' =>
'mw-statistics-edits' ]
159 $this->
formatRow( $this->
msg(
'statistics-edits-average' )->parse(),
161 sprintf(
'%.2f', $this->total ? $this->
edits / $this->total : 0 )
162 ), [
'class' =>
'mw-statistics-edits-average' ]
167 return Xml::openElement(
'tr' ) .
168 Xml::tags(
'th', [
'colspan' =>
'2' ],
169 $this->
msg(
'statistics-header-users' )->parse() ) .
170 Xml::closeElement(
'tr' ) .
171 $this->
formatRow( $this->
msg(
'statistics-users' )->parse() .
' ' .
174 $this->
msg(
'listgrouprights-members' )->
text()
177 [
'class' =>
'mw-statistics-users' ]
179 $this->
formatRow( $this->
msg(
'statistics-users-active' )->parse() .
' ' .
182 $this->
msg(
'listgrouprights-members' )->
text()
184 $this->
getLanguage()->formatNum( $this->activeUsers ),
185 [
'class' =>
'mw-statistics-users-active' ],
186 'statistics-users-active-desc',
188 $this->
getConfig()->
get(
'ActiveUserDays' ) )
195 foreach ( $this->
getConfig()->
get(
'GroupPermissions' ) as $group => $permissions ) {
196 # Skip generic * and implicit groups
202 $msg = $this->
msg(
'group-' . $groupname );
203 if ( $msg->isBlank() ) {
206 $groupnameLocalized = $msg->text();
208 $msg = $this->
msg(
'grouppage-' . $groupname )->inContentLanguage();
209 if ( $msg->isBlank() ) {
210 $grouppageLocalized = MWNamespace::getCanonicalName(
NS_PROJECT ) .
213 $grouppageLocalized = $msg->text();
215 $linkTarget = Title::newFromText( $grouppageLocalized );
228 $this->
msg(
'listgrouprights-members' )->
text(),
230 [
'group' => $group ]
232 # Add a class when a usergroup contains no members to allow hiding these rows
235 if ( $countUsers == 0 ) {
236 $classZero =
' statistics-group-zero';
238 $text .= $this->
formatRow( $grouppage .
' ' . $grouplink,
240 [
'class' =>
'statistics-group-' . Sanitizer::escapeClass( $group ) .
257 foreach ( $stats as
$header => $items ) {
261 if (
$header !==
'statistics-header-hooks' ) {
266 foreach ( $items as $key =>
$value ) {
269 $number =
$value[
'number'];
271 $name = $this->
msg( $key )->parse();
278 [
'class' =>
'mw-statistics-hook',
'id' =>
'mw-' . $key ]
283 if ( $return ===
'' ) {
288 $return .= $this->
getOtherStats( [
'statistics-header-hooks' =>
303 return Xml::openElement(
'tr' ) .
304 Xml::tags(
'th', [
'colspan' =>
'2' ], $this->
msg(
$header )->parse() ) .
305 Xml::closeElement(
'tr' );
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
static numberingroup( $group)
Find the number of users in a given user group.
Parent class for all special pages.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
getContext()
Gets the context this SpecialPage is executed in.
msg( $key)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getLanguage()
Shortcut to get user's language.
MediaWiki Linker LinkRenderer null $linkRenderer
Special page lists various statistics, including the contents of site_stats, plus page view details i...
getOtherStats(array $stats)
Conversion of external statistics into an internal representation Following a ([<header-message>][<it...
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getPageStats()
Each of these methods is pretty self-explanatory, get a particular row for the table of statistics.
formatRowHeader( $header)
Format row header.
formatRow( $text, $number, $trExtraParams=[], $descMsg='', $descMsgParam='')
Format a row.
execute( $par)
Default execute method Checks user permissions.
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))