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, $wgUseRCPatrol;
19 $usepatrol = ( $wgUseRCPatrol && $wgUser->getID() != 0 &&
20 ( $wgUser->isSysop() ||
!$wgOnlySysopsCanPatrol ) ) ?
1 : 0;
21 $dbr =& wfGetDB( DB_SLAVE
);
22 extract( $dbr->tableNames( 'recentchanges', 'cur' ) );
25 "SELECT 'Newpages' as type,
26 rc_namespace AS namespace,
30 rc_user_text AS user_text,
31 rc_comment as comment,
32 rc_timestamp AS timestamp,
33 '{$usepatrol}' as usepatrol,
34 rc_patrolled AS patrolled,
36 length(cur_text) as length,
38 FROM $recentchanges,$cur
39 WHERE rc_cur_id=cur_id AND rc_new=1
40 AND rc_namespace=0 AND cur_is_redirect=0";
43 function formatResult( $skin, $result ) {
44 global $wgLang, $wgUser, $wgOnlySysopsCanPatrol, $wgUseRCPatrol;
46 $ut = $result->user_text
;
48 $length = wfMsg( "nbytes", $wgLang->formatNum( $result->length
) );
49 $c = $skin->formatComment($result->comment
);
51 if ( $u == 0 ) { # not by a logged-in user
55 $ul = $skin->makeLink( $wgLang->getNsText(NS_USER
) . ":{$ut}", $ut );
58 $d = $wgLang->timeanddate( $result->timestamp
, true );
60 # Since there is no diff link, we need to give users a way to
61 # mark the article as patrolled if it isn't already
62 if ( $wgUseRCPatrol && $result->usepatrol
&& $result->patrolled
== 0 &&
63 $wgUser->getID() != 0 && ( $wgUser->isSysop() ||
!$wgOnlySysopsCanPatrol ) )
64 $link = $skin->makeKnownLink( $result->title
, '', "rcid={$result->rcid}" );
66 $link = $skin->makeKnownLink( $result->title
, '' );
68 $s = "{$d} {$link} ({$length}) . . {$ul}";
70 if ( "" != $c && "*" != $c ) {
71 $s .= " <em>({$c})</em>";
78 function wfSpecialNewpages()
81 list( $limit, $offset ) = wfCheckLimits();
83 $npp = new NewPagesPage();
85 if( !$npp->doFeed( $wgRequest->getVal( 'feed' ) ) ) {
86 $npp->doQuery( $offset, $limit );