Load text for Newpages RSS/Atom feed separately (needed for new storage mechanism)
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 18 Mar 2005 06:49:14 +0000 (06:49 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 18 Mar 2005 06:49:14 +0000 (06:49 +0000)
Use full title in feeds if they include non-main-ns stuff

includes/QueryPage.php
includes/SpecialNewpages.php

index 4ac5aa9..37b4816 100644 (file)
@@ -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 = '<p>' . htmlspecialchars( wfMsg( 'summary' ) ) . ': ' . $text . "</p>\n<hr />\n<div>" .
-                               nl2br( htmlspecialchars( $row->text ) ) . "</div>";;
-               }
-               return $text;
+               return isset( $row->comment )
+                       ? htmlspecialchars( $row->comment )
+                       : '';
        }
 
        function feedItemAuthor( $row ) {
index c19ff75..a60324d 100644 (file)
@@ -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 '<p>' . htmlspecialchars( wfMsg( 'summary' ) ) . ': ' . $text . "</p>\n<hr />\n<div>" .
+                                       nl2br( htmlspecialchars( $revision->getText() ) ) . "</div>";
+                       }
+               }
+               return parent::feedItemDesc( $row );
+       }
 }
 
 /**