5 * @addtogroup SpecialPage
9 * Show the special page
11 * @param mixed $par (not used)
13 function wfSpecialStatistics( $par = '' ) {
14 global $wgOut, $wgLang, $wgRequest;
15 $dbr = wfGetDB( DB_SLAVE
);
17 $views = SiteStats
::views();
18 $edits = SiteStats
::edits();
19 $good = SiteStats
::articles();
20 $images = SiteStats
::images();
21 $total = SiteStats
::pages();
22 $users = SiteStats
::users();
23 $admins = SiteStats
::admins();
24 $numJobs = SiteStats
::jobs();
26 if( $wgRequest->getVal( 'action' ) == 'raw' ) {
28 header( 'Pragma: nocache' );
29 echo "total=$total;good=$good;views=$views;edits=$edits;users=$users;admins=$admins;images=$images;jobs=$numJobs\n";
32 $text = '==' . wfMsg( 'sitestats' ) . "==\n";
33 $text .= wfMsgExt( 'sitestatstext', array( 'parsemag' ),
34 $wgLang->formatNum( $total ),
35 $wgLang->formatNum( $good ),
36 $wgLang->formatNum( $views ),
37 $wgLang->formatNum( $edits ),
38 $wgLang->formatNum( sprintf( '%.2f', $total ?
$edits / $total : 0 ) ),
39 $wgLang->formatNum( sprintf( '%.2f', $edits ?
$views / $edits : 0 ) ),
40 $wgLang->formatNum( $numJobs ),
41 $wgLang->formatNum( $images )
44 $text .= "\n==" . wfMsg( 'userstats' ) . "==\n";
45 $text .= wfMsgExt( 'userstatstext', array ( 'parsemag' ),
46 $wgLang->formatNum( $users ),
47 $wgLang->formatNum( $admins ),
48 '[[' . wfMsgForContent( 'grouppage-sysop' ) . ']]', # TODO somehow remove, kept for backwards compatibility
49 $wgLang->formatNum( sprintf( '%.2f', $admins / $users * 100 ) ),
50 User
::makeGroupLinkWiki( 'sysop' )
53 global $wgDisableCounters, $wgMiserMode, $wgUser, $wgLang, $wgContLang;
54 if( !$wgDisableCounters && !$wgMiserMode ) {
63 'page_is_redirect' => 0,
68 'ORDER BY' => 'page_counter DESC',
72 if( $res->numRows() > 0 ) {
73 $text .= '==' . wfMsg( 'statistics-mostpopular' ) . "==\n";
74 while( $row = $res->fetchObject() ) {
75 $title = Title
::makeTitleSafe( $row->page_namespace
, $row->page_title
);
76 if( $title instanceof Title
)
77 $text .= '* [[' . $title->getPrefixedText() . ']] (' . $wgLang->formatNum( $row->page_counter
) . ")\n";
83 $footer = wfMsg( 'statistics-footer' );
84 if( !wfEmptyMsg( 'statistics-footer', $footer ) && $footer != '' )
87 $wgOut->addWikiText( $text );