4 * Special page lists various statistics, including the contents of
5 * `site_stats`, plus page view details if enabled
12 * Show the special page
14 * @param mixed $par (not used)
16 function wfSpecialStatistics( $par = '' ) {
17 global $wgOut, $wgLang, $wgRequest;
18 $dbr = wfGetDB( DB_SLAVE
);
20 $views = SiteStats
::views();
21 $edits = SiteStats
::edits();
22 $good = SiteStats
::articles();
23 $images = SiteStats
::images();
24 $total = SiteStats
::pages();
25 $users = SiteStats
::users();
26 $admins = SiteStats
::admins();
27 $numJobs = SiteStats
::jobs();
29 if( $wgRequest->getVal( 'action' ) == 'raw' ) {
31 header( 'Pragma: nocache' );
32 echo "total=$total;good=$good;views=$views;edits=$edits;users=$users;admins=$admins;images=$images;jobs=$numJobs\n";
35 $text = "__NOTOC__\n";
36 $text .= '==' . wfMsgNoTrans( 'sitestats' ) . "==\n";
37 $text .= wfMsgExt( 'sitestatstext', array( 'parsemag' ),
38 $wgLang->formatNum( $total ),
39 $wgLang->formatNum( $good ),
40 $wgLang->formatNum( $views ),
41 $wgLang->formatNum( $edits ),
42 $wgLang->formatNum( sprintf( '%.2f', $total ?
$edits / $total : 0 ) ),
43 $wgLang->formatNum( sprintf( '%.2f', $edits ?
$views / $edits : 0 ) ),
44 $wgLang->formatNum( $numJobs ),
45 $wgLang->formatNum( $images )
48 $text .= "==" . wfMsgNoTrans( 'userstats' ) . "==\n";
49 $text .= wfMsgExt( 'userstatstext', array ( 'parsemag' ),
50 $wgLang->formatNum( $users ),
51 $wgLang->formatNum( $admins ),
52 '[[' . wfMsgForContent( 'grouppage-sysop' ) . ']]', # TODO somehow remove, kept for backwards compatibility
53 $wgLang->formatNum( @sprintf
( '%.2f', $admins / $users * 100 ) ),
54 User
::makeGroupLinkWiki( 'sysop' )
57 global $wgDisableCounters, $wgMiserMode, $wgUser, $wgLang, $wgContLang;
58 if( !$wgDisableCounters && !$wgMiserMode ) {
67 'page_is_redirect' => 0,
72 'ORDER BY' => 'page_counter DESC',
76 if( $res->numRows() > 0 ) {
77 $text .= "==" . wfMsgNoTrans( 'statistics-mostpopular' ) . "==\n";
78 while( $row = $res->fetchObject() ) {
79 $title = Title
::makeTitleSafe( $row->page_namespace
, $row->page_title
);
80 if( $title instanceof Title
)
81 $text .= '* [[:' . $title->getPrefixedText() . ']] (' . $wgLang->formatNum( $row->page_counter
) . ")\n";
87 $footer = wfMsgNoTrans( 'statistics-footer' );
88 if( !wfEmptyMsg( 'statistics-footer', $footer ) && $footer != '' )
89 $text .= "\n" . $footer;
91 $wgOut->addWikiText( $text );