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