From 31b68859958d5860a62598646e8f66898799ff57 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 18 Mar 2005 06:49:14 +0000 Subject: [PATCH] Load text for Newpages RSS/Atom feed separately (needed for new storage mechanism) Use full title in feeds if they include non-main-ns stuff --- includes/QueryPage.php | 17 ++++------------- includes/SpecialNewpages.php | 20 +++++++++++++++----- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 4ac5aa9d54..37b48161c8 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -274,7 +274,7 @@ class QueryPage { } return new FeedItem( - $title->getText(), + $title->getPrefixedText(), $this->feedItemDesc( $row ), $title->getFullURL(), $date, @@ -286,18 +286,9 @@ class QueryPage { } function feedItemDesc( $row ) { - $text = ''; - if( isset( $row->comment ) ) { - $text = htmlspecialchars( $row->comment ); - } else { - $text = ''; - } - - if( isset( $row->text ) ) { - $text = '

' . htmlspecialchars( wfMsg( 'summary' ) ) . ': ' . $text . "

\n
\n
" . - nl2br( htmlspecialchars( $row->text ) ) . "
";; - } - return $text; + return isset( $row->comment ) + ? htmlspecialchars( $row->comment ) + : ''; } function feedItemAuthor( $row ) { diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index c19ff75c4f..a60324d79a 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -47,12 +47,11 @@ class NewPagesPage extends QueryPage { '{$usepatrol}' as usepatrol, rc_patrolled AS patrolled, rc_id AS rcid, - length(old_text) as length, - old_text as text - FROM $recentchanges,$page,$text + page_len as length, + page_latest as rev_id + FROM $recentchanges,$page WHERE rc_cur_id=page_id AND rc_new=1 - AND rc_namespace=".NS_MAIN." AND page_is_redirect=0 - AND page_latest=old_id"; + AND rc_namespace=".NS_MAIN." AND page_is_redirect=0"; } function formatResult( $skin, $result ) { @@ -86,6 +85,17 @@ class NewPagesPage extends QueryPage { return $s; } + + function feedItemDesc( $row ) { + if( isset( $row->rev_id ) ) { + $revision = Revision::newFromId( $row->rev_id ); + if( $revision ) { + return '

' . htmlspecialchars( wfMsg( 'summary' ) ) . ': ' . $text . "

\n
\n
" . + nl2br( htmlspecialchars( $revision->getText() ) ) . "
"; + } + } + return parent::feedItemDesc( $row ); + } } /** -- 2.20.1