Minor link update fix
[mediawiki.git] / includes / SpecialStatistics.php
blob8c4335ffdc996f72b5811d991811025cc0fa8123
1 <?
3 function wfSpecialStatistics()
5 global $wgUser, $wgOut;
6 $fname = "wfSpecialStatistics";
8 $wgOut->addHTML( "<h2>" . wfMsg( "sitestats" ) . "</h2>\n" );
10 $sql = "SELECT COUNT(cur_id) AS total FROM cur";
11 $res = wfQuery( $sql, $fname );
12 $row = wfFetchObject( $res );
13 $total = $row->total;
15 $sql = "SELECT ss_total_views, ss_total_edits, ss_good_articles " .
16 "FROM site_stats WHERE ss_row_id=1";
17 $res = wfQuery( $sql, $fname );
18 $row = wfFetchObject( $res );
19 $views = $row->ss_total_views;
20 $edits = $row->ss_total_edits;
21 $good = $row->ss_good_articles;
23 $text = str_replace( "$1", $total, wfMsg( "sitestatstext" ) );
24 $text = str_replace( "$2", $good, $text );
25 $text = str_replace( "$3", $views, $text );
26 $text = str_replace( "$4", $edits, $text );
27 $text = str_replace( "$5", sprintf( "%.2f", $edits / $total ), $text );
28 $text = str_replace( "$6", sprintf( "%.2f", $views / $edits ), $text );
30 $wgOut->addHTML( $text );
31 $wgOut->addHTML( "<h2>" . wfMsg( "userstats" ) . "</h2>\n" );
33 $sql = "SELECT COUNT(user_id) AS total FROM user";
34 $res = wfQuery( $sql, $fname );
35 $row = wfFetchObject( $res );
36 $total = $row->total;
38 $sql = "SELECT COUNT(user_id) AS total FROM user " .
39 "WHERE user_rights LIKE '%sysop%'";
40 $res = wfQuery( $sql, $fname );
41 $row = wfFetchObject( $res );
42 $admins = $row->total;
44 $sk = $wgUser->getSkin();
45 $ap = $sk->makeKnownLink( wfMsg( "administrators" ), "" );
47 $text = str_replace( "$1", $total, wfMsg( "userstatstext" ) );
48 $text = str_replace( "$2", $admins, $text );
49 $text = str_replace( "$3", $ap, $text );
50 $wgOut->addHTML( $text );