00001 <?php 00002 00003 require_once( "QueryPage.php" ); 00004 00005 class NewPagesPage extends QueryPage { 00006 00007 function getName() { 00008 return "Newpages"; 00009 } 00010 00011 function isExpensive() { 00012 # Indexed on RC, and will *not* work with querycache yet. 00013 return false; 00014 #return parent::isExpensive(); 00015 } 00016 00017 function getSQL( $offset, $limit ) { 00018 return 00019 "SELECT 'Newpages' as type, 00020 rc_namespace AS namespace, 00021 rc_title AS title, 00022 rc_cur_id AS value, 00023 00024 rc_user AS user, 00025 rc_user_text AS user_text, 00026 rc_comment as comment, 00027 rc_timestamp AS timestamp, 00028 length(cur_text) as length, 00029 cur_text as text 00030 FROM recentchanges,cur 00031 WHERE rc_cur_id=cur_id AND rc_new=1 00032 AND rc_namespace=0 AND cur_is_redirect=0"; 00033 } 00034 00035 function formatResult( $skin, $result ) { 00036 global $wgLang; 00037 $u = $result->user; 00038 $ut = $result->user_text; 00039 00040 $length = wfMsg( "nbytes", $wgLang->formatNum( $result->length ) ); 00041 $c = $skin->formatComment($result->comment ); 00042 00043 if ( 0 == $u ) { # not by a logged-in user 00044 $ul = $ut; 00045 } 00046 else { 00047 $ul = $skin->makeLink( $wgLang->getNsText(NS_USER) . ":{$ut}", $ut ); 00048 } 00049 00050 $d = $wgLang->timeanddate( $result->timestamp, true ); 00051 $link = $skin->makeKnownLink( $result->title, "" ); 00052 $s = "{$d} {$link} ({$length}) . . {$ul}"; 00053 00054 if ( "" != $c && "*" != $c ) { 00055 $s .= " <em>({$c})</em>"; 00056 } 00057 00058 return $s; 00059 } 00060 } 00061 00062 function wfSpecialNewpages() 00063 { 00064 global $wgRequest; 00065 list( $limit, $offset ) = wfCheckLimits(); 00066 00067 $npp = new NewPagesPage(); 00068 00069 if( !$npp->doFeed( $wgRequest->getVal( 'feed' ) ) ) { 00070 $npp->doQuery( $offset, $limit ); 00071 } 00072 } 00073 00074 ?>