Conducting a conversation by means of comments
[mediawiki.git] / includes / SpecialNewpages.php
blob77940e96eba11b0c63fd417f8e99719f258b155b
1 <?php
3 require_once( "QueryPage.php" );
5 class NewPagesPage extends QueryPage {
7 function getName() {
8 return "Newpages";
11 function isExpensive() {
12 # Indexed on RC, and will *not* work with querycache yet.
13 return false;
14 #return parent::isExpensive();
17 function getSQL( $offset, $limit ) {
18 return
19 "SELECT 'Newpages' as type,
20 rc_namespace AS namespace,
21 rc_title AS title,
22 rc_cur_id AS value,
24 rc_user AS user,
25 rc_user_text AS user_text,
26 rc_comment as comment,
27 rc_timestamp AS timestamp,
28 length(cur_text) as length,
29 cur_text as text
30 FROM recentchanges,cur
31 WHERE rc_cur_id=cur_id AND rc_new=1
32 AND rc_namespace=0 AND cur_is_redirect=0";
35 function formatResult( $skin, $result ) {
36 global $wgLang;
37 $u = $result->user;
38 $ut = $result->user_text;
40 $length = wfMsg( "nbytes", $wgLang->formatNum( $result->length ) );
41 $c = $skin->formatComment($result->comment );
43 if ( 0 == $u ) { # not by a logged-in user
44 $ul = $ut;
46 else {
47 $ul = $skin->makeLink( $wgLang->getNsText(NS_USER) . ":{$ut}", $ut );
50 $d = $wgLang->timeanddate( $result->timestamp, true );
51 $link = $skin->makeKnownLink( $result->title, "" );
52 $s = "{$d} {$link} ({$length}) . . {$ul}";
54 if ( "" != $c && "*" != $c ) {
55 $s .= " <em>({$c})</em>";
58 return $s;
62 function wfSpecialNewpages()
64 global $wgRequest;
65 list( $limit, $offset ) = wfCheckLimits();
67 $npp = new NewPagesPage();
69 if( !$npp->doFeed( $wgRequest->getVal( 'feed' ) ) ) {
70 $npp->doQuery( $offset, $limit );