5 * @subpackage SpecialPage
11 require_once( "QueryPage.php" );
16 * @subpackage SpecialPage
18 class NewPagesPage
extends QueryPage
{
24 function isExpensive() {
25 # Indexed on RC, and will *not* work with querycache yet.
27 #return parent::isExpensive();
31 global $wgUser, $wgOnlySysopsCanPatrol, $wgUseRCPatrol;
32 $usepatrol = ( $wgUseRCPatrol && $wgUser->getID() != 0 &&
33 ( $wgUser->isSysop() ||
!$wgOnlySysopsCanPatrol ) ) ?
1 : 0;
34 $dbr =& wfGetDB( DB_SLAVE
);
35 extract( $dbr->tableNames( 'recentchanges', 'cur' ) );
38 "SELECT 'Newpages' as type,
39 rc_namespace AS namespace,
43 rc_user_text AS user_text,
44 rc_comment as comment,
45 rc_timestamp AS timestamp,
46 '{$usepatrol}' as usepatrol,
47 rc_patrolled AS patrolled,
49 length(cur_text) as length,
51 FROM $recentchanges,$cur
52 WHERE rc_cur_id=cur_id AND rc_new=1
53 AND rc_namespace=0 AND cur_is_redirect=0";
56 function formatResult( $skin, $result ) {
57 global $wgLang, $wgUser, $wgOnlySysopsCanPatrol, $wgUseRCPatrol;
59 $ut = $result->user_text
;
61 $length = wfMsg( "nbytes", $wgLang->formatNum( $result->length
) );
62 $c = $skin->formatComment($result->comment
);
64 if ( $u == 0 ) { # not by a logged-in user
68 $ul = $skin->makeLink( $wgLang->getNsText(NS_USER
) . ":{$ut}", $ut );
71 $d = $wgLang->timeanddate( $result->timestamp
, true );
73 # Since there is no diff link, we need to give users a way to
74 # mark the article as patrolled if it isn't already
75 if ( $wgUseRCPatrol && !is_null ( $result->usepatrol
) && $result->usepatrol
&&
76 $result->patrolled
== 0 && $wgUser->getID() != 0 &&
77 ( $wgUser->isSysop() ||
!$wgOnlySysopsCanPatrol ) )
78 $link = $skin->makeKnownLink( $result->title
, '', "rcid={$result->rcid}" );
80 $link = $skin->makeKnownLink( $result->title
, '' );
82 $s = "{$d} {$link} ({$length}) . . {$ul}";
84 if ( "" != $c && "*" != $c ) {
85 $s .= " <em>({$c})</em>";
95 function wfSpecialNewpages()
98 list( $limit, $offset ) = wfCheckLimits();
100 $npp = new NewPagesPage();
102 if( !$npp->doFeed( $wgRequest->getVal( 'feed' ) ) ) {
103 $npp->doQuery( $offset, $limit );