9 require_once( "QueryPage.php" );
14 class NewPagesPage
extends QueryPage
{
20 function isExpensive() {
21 # Indexed on RC, and will *not* work with querycache yet.
23 #return parent::isExpensive();
27 global $wgUser, $wgOnlySysopsCanPatrol, $wgUseRCPatrol;
28 $usepatrol = ( $wgUseRCPatrol && $wgUser->getID() != 0 &&
29 ( $wgUser->isSysop() ||
!$wgOnlySysopsCanPatrol ) ) ?
1 : 0;
30 $dbr =& wfGetDB( DB_SLAVE
);
31 extract( $dbr->tableNames( 'recentchanges', 'cur' ) );
34 "SELECT 'Newpages' as type,
35 rc_namespace AS namespace,
39 rc_user_text AS user_text,
40 rc_comment as comment,
41 rc_timestamp AS timestamp,
42 '{$usepatrol}' as usepatrol,
43 rc_patrolled AS patrolled,
45 length(cur_text) as length,
47 FROM $recentchanges,$cur
48 WHERE rc_cur_id=cur_id AND rc_new=1
49 AND rc_namespace=0 AND cur_is_redirect=0";
52 function formatResult( $skin, $result ) {
53 global $wgLang, $wgUser, $wgOnlySysopsCanPatrol, $wgUseRCPatrol;
55 $ut = $result->user_text
;
57 $length = wfMsg( "nbytes", $wgLang->formatNum( $result->length
) );
58 $c = $skin->formatComment($result->comment
);
60 if ( $u == 0 ) { # not by a logged-in user
64 $ul = $skin->makeLink( $wgLang->getNsText(NS_USER
) . ":{$ut}", $ut );
67 $d = $wgLang->timeanddate( $result->timestamp
, true );
69 # Since there is no diff link, we need to give users a way to
70 # mark the article as patrolled if it isn't already
71 if ( $wgUseRCPatrol && !is_null ( $result->usepatrol
) && $result->usepatrol
&&
72 $result->patrolled
== 0 && $wgUser->getID() != 0 &&
73 ( $wgUser->isSysop() ||
!$wgOnlySysopsCanPatrol ) )
74 $link = $skin->makeKnownLink( $result->title
, '', "rcid={$result->rcid}" );
76 $link = $skin->makeKnownLink( $result->title
, '' );
78 $s = "{$d} {$link} ({$length}) . . {$ul}";
80 if ( "" != $c && "*" != $c ) {
81 $s .= " <em>({$c})</em>";
91 function wfSpecialNewpages()
94 list( $limit, $offset ) = wfCheckLimits();
96 $npp = new NewPagesPage();
98 if( !$npp->doFeed( $wgRequest->getVal( 'feed' ) ) ) {
99 $npp->doQuery( $offset, $limit );