3 require_once( "QueryPage.php" );
5 class NewPagesPage
extends QueryPage
{
11 function isExpensive() {
12 # Indexed on RC, and will *not* work with querycache yet.
14 #return parent::isExpensive();
18 global $wgUser, $wgOnlySysopsCanPatrol;
19 $usepatrol = ( $wgUser->getID() != 0 && ( $wgUser->isSysop() ||
!$wgOnlySysopsCanPatrol ) ) ?
1 : 0;
20 $dbr =& wfGetDB( DB_SLAVE
);
21 extract( $dbr->tableNames( 'recentchanges', 'cur' ) );
24 "SELECT 'Newpages' as type,
25 rc_namespace AS namespace,
29 rc_user_text AS user_text,
30 rc_comment as comment,
31 rc_timestamp AS timestamp,
32 '{$usepatrol}' as usepatrol,
33 rc_patrolled AS patrolled,
35 length(cur_text) as length,
37 FROM $recentchanges,$cur
38 WHERE rc_cur_id=cur_id AND rc_new=1
39 AND rc_namespace=0 AND cur_is_redirect=0";
42 function formatResult( $skin, $result ) {
43 global $wgLang, $wgUser, $wgOnlySysopsCanPatrol;
45 $ut = $result->user_text
;
47 $length = wfMsg( "nbytes", $wgLang->formatNum( $result->length
) );
48 $c = $skin->formatComment($result->comment
);
50 if ( 0 == $u ) { # not by a logged-in user
54 $ul = $skin->makeLink( $wgLang->getNsText(NS_USER
) . ":{$ut}", $ut );
57 $d = $wgLang->timeanddate( $result->timestamp
, true );
59 # Since there is no diff link, we need to give users a way to
60 # mark the article as patrolled if it isn't already
61 if ( $result->usepatrol
&& $result->patrolled
== 0 && $wgUser->getID() != 0 &&
62 ( $wgUser->isSysop() ||
!$wgOnlySysopsCanPatrol ) )
63 $link = $skin->makeKnownLink( $result->title
, '', "rcid={$result->rcid}" );
65 $link = $skin->makeKnownLink( $result->title
, '' );
67 $s = "{$d} {$link} ({$length}) . . {$ul}";
69 if ( "" != $c && "*" != $c ) {
70 $s .= " <em>({$c})</em>";
77 function wfSpecialNewpages()
80 list( $limit, $offset ) = wfCheckLimits();
82 $npp = new NewPagesPage();
84 if( !$npp->doFeed( $wgRequest->getVal( 'feed' ) ) ) {
85 $npp->doQuery( $offset, $limit );