Index: trunk/phase3/includes/SpecialStatistics.php |
— | — | @@ -1,18 +1,17 @@ |
2 | 2 | <?php |
| 3 | + |
3 | 4 | /** |
4 | | -* |
5 | | -* @addtogroup SpecialPage |
6 | | -*/ |
| 5 | + * |
| 6 | + * @addtogroup SpecialPage |
| 7 | + */ |
7 | 8 | |
8 | 9 | /** |
9 | | -* constructor |
10 | | -*/ |
11 | | -function wfSpecialStatistics() { |
| 10 | + * Show the special page |
| 11 | + * |
| 12 | + * @param mixed $par (not used) |
| 13 | + */ |
| 14 | +function wfSpecialStatistics( $par = '' ) { |
12 | 15 | global $wgOut, $wgLang, $wgRequest; |
13 | | - $fname = 'wfSpecialStatistics'; |
14 | | - |
15 | | - $action = $wgRequest->getVal( 'action' ); |
16 | | - |
17 | 16 | $dbr = wfGetDB( DB_SLAVE ); |
18 | 17 | |
19 | 18 | $views = SiteStats::views(); |
— | — | @@ -24,14 +23,14 @@ |
25 | 24 | $admins = SiteStats::admins(); |
26 | 25 | $numJobs = SiteStats::jobs(); |
27 | 26 | |
28 | | - if ($action == 'raw') { |
| 27 | + if( $wgRequest->getVal( 'action' ) == 'raw' ) { |
29 | 28 | $wgOut->disable(); |
30 | 29 | header( 'Pragma: nocache' ); |
31 | 30 | echo "total=$total;good=$good;views=$views;edits=$edits;users=$users;admins=$admins;images=$images;jobs=$numJobs\n"; |
32 | 31 | return; |
33 | 32 | } else { |
34 | | - $text = '==' . wfMsg( 'sitestats' ) . "==\n" ; |
35 | | - $text .= wfMsgExt( 'sitestatstext', array ( 'parsemag' ), |
| 33 | + $text = '==' . wfMsg( 'sitestats' ) . "==\n"; |
| 34 | + $text .= wfMsgExt( 'sitestatstext', array( 'parsemag' ), |
36 | 35 | $wgLang->formatNum( $total ), |
37 | 36 | $wgLang->formatNum( $good ), |
38 | 37 | $wgLang->formatNum( $views ), |
— | — | @@ -43,7 +42,6 @@ |
44 | 43 | ); |
45 | 44 | |
46 | 45 | $text .= "\n==" . wfMsg( 'userstats' ) . "==\n"; |
47 | | - |
48 | 46 | $text .= wfMsgExt( 'userstatstext', array ( 'parsemag' ), |
49 | 47 | $wgLang->formatNum( $users ), |
50 | 48 | $wgLang->formatNum( $admins ), |
— | — | @@ -52,32 +50,41 @@ |
53 | 51 | User::makeGroupLinkWiki( 'sysop' ) |
54 | 52 | ); |
55 | 53 | |
56 | | - $wgOut->addWikiText( $text ); |
57 | | - |
58 | 54 | global $wgDisableCounters, $wgMiserMode, $wgUser, $wgLang, $wgContLang; |
59 | 55 | if( !$wgDisableCounters && !$wgMiserMode ) { |
60 | | - $page = $dbr->tableName( 'page' ); |
61 | | - $sql = "SELECT page_namespace, page_title, page_counter FROM {$page} WHERE page_is_redirect = 0 AND page_counter > 0 ORDER BY page_counter DESC"; |
62 | | - $sql = $dbr->limitResult($sql, 10, 0); |
63 | | - $res = $dbr->query( $sql, $fname ); |
64 | | - if( $res ) { |
65 | | - $wgOut->addHtml( '<h2>' . wfMsgHtml( 'statistics-mostpopular' ) . '</h2>' ); |
66 | | - $skin = $wgUser->getSkin(); |
67 | | - $wgOut->addHtml( '<ol>' ); |
68 | | - while( $row = $dbr->fetchObject( $res ) ) { |
69 | | - $link = $skin->makeKnownLinkObj( Title::makeTitleSafe( $row->page_namespace, $row->page_title ) ); |
70 | | - $dirmark = $wgContLang->getDirMark(); |
71 | | - $wgOut->addHtml( '<li>' . $link . $dirmark . ' [' . $wgLang->formatNum( $row->page_counter ) . ']</li>' ); |
| 56 | + $res = $dbr->select( |
| 57 | + 'page', |
| 58 | + array( |
| 59 | + 'page_namespace', |
| 60 | + 'page_title', |
| 61 | + 'page_counter', |
| 62 | + ), |
| 63 | + array( |
| 64 | + 'page_is_redirect' => 0, |
| 65 | + 'page_counter > 0', |
| 66 | + ), |
| 67 | + __METHOD__, |
| 68 | + array( |
| 69 | + 'ORDER BY' => 'page_counter DESC', |
| 70 | + 'LIMIT' => 10, |
| 71 | + ) |
| 72 | + ); |
| 73 | + if( $res->numRows() > 0 ) { |
| 74 | + $text .= '==' . wfMsg( 'statistics-mostpopular' ) . "==\n"; |
| 75 | + while( $row = $res->fetchObject() ) { |
| 76 | + $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title ); |
| 77 | + if( $title instanceof Title ) |
| 78 | + $text .= '* [[' . $title->getPrefixedText() . ']] (' . $wgLang->formatNum( $row->page_counter ) . ")\n"; |
72 | 79 | } |
73 | | - $wgOut->addHtml( '</ol>' ); |
74 | | - $dbr->freeResult( $res ); |
| 80 | + $res->free(); |
75 | 81 | } |
76 | 82 | } |
77 | 83 | |
78 | 84 | $footer = wfMsg( 'statistics-footer' ); |
79 | 85 | if( !wfEmptyMsg( 'statistics-footer', $footer ) && $footer != '' ) |
80 | | - $wgOut->addWikiText( $footer ); |
81 | | - |
| 86 | + $text .= $footer; |
| 87 | + |
| 88 | + $wgOut->addWikiText( $text ); |
82 | 89 | } |
83 | | -} |
84 | | - |
| 90 | + |
| 91 | +} |
\ No newline at end of file |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -398,6 +398,8 @@ |
399 | 399 | in the wrong order |
400 | 400 | * (bug 10985) Special:DoubleRedirects was omitting "fixed" results when cached, |
401 | 401 | leading to inconsistent paging behaviour |
| 402 | +* (bug 9026) Incorrect heading numbering when viewing Special:Statistics with |
| 403 | + "auto-numbered headings" enabled |
402 | 404 | |
403 | 405 | == API changes since 1.10 == |
404 | 406 | |