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->isAllowed('patrol') ||
!$wgOnlySysopsCanPatrol ) ) ?
1 : 0;
34 $dbr =& wfGetDB( DB_SLAVE
);
35 extract( $dbr->tableNames( 'recentchanges', 'page', 'text' ) );
37 # FIXME: text will break with compression
39 "SELECT 'Newpages' as type,
40 rc_namespace AS namespace,
44 rc_user_text AS user_text,
45 rc_comment as comment,
46 rc_timestamp AS timestamp,
47 '{$usepatrol}' as usepatrol,
48 rc_patrolled AS patrolled,
50 length(old_text) as length,
52 FROM $recentchanges,$page,$text
53 WHERE rc_cur_id=page_id AND rc_new=1
54 AND rc_namespace=".NS_MAIN
." AND page_is_redirect=0
55 AND page_latest=old_id";
58 function formatResult( $skin, $result ) {
59 global $wgLang, $wgContLang, $wgUser, $wgOnlySysopsCanPatrol, $wgUseRCPatrol;
61 $ut = $result->user_text
;
63 $length = wfMsg( "nbytes", $wgLang->formatNum( $result->length
) );
64 $c = $skin->formatComment($result->comment
);
66 if ( $u == 0 ) { # not by a logged-in user
70 $ul = $skin->makeLink( $wgContLang->getNsText(NS_USER
) . ":{$ut}", $ut );
73 $d = $wgLang->timeanddate( $result->timestamp
, true );
75 # Since there is no diff link, we need to give users a way to
76 # mark the article as patrolled if it isn't already
77 if ( $wgUseRCPatrol && !is_null ( $result->usepatrol
) && $result->usepatrol
&&
78 $result->patrolled
== 0 && $wgUser->getID() != 0 &&
79 ( $wgUser->isAllowed('patrol') ||
!$wgOnlySysopsCanPatrol ) )
80 $link = $skin->makeKnownLink( $result->title
, '', "rcid={$result->rcid}" );
82 $link = $skin->makeKnownLink( $result->title
, '' );
84 $s = "{$d} {$link} ({$length}) . . {$ul}";
86 if ( "" != $c && "*" != $c ) {
87 $s .= " <em>({$c})</em>";
97 function wfSpecialNewpages()
100 list( $limit, $offset ) = wfCheckLimits();
102 $npp = new NewPagesPage();
104 if( !$npp->doFeed( $wgRequest->getVal( 'feed' ) ) ) {
105 $npp->doQuery( $offset, $limit );