From: Aryeh Gregor Date: Fri, 15 Jan 2010 18:00:56 +0000 (+0000) Subject: Add to RSS to avoid duplicates X-Git-Tag: 1.31.0-rc.0~38254 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=11284695f136174a87105e8df80f834509954132;p=lhc%2Fweb%2Fwiklou.git Add to RSS to avoid duplicates Bug 7346. Patch by Jools Wills (buzz). --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 174b80b1a3..bb442bac68 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -303,6 +303,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * LanguageConverter now support nested using of manual convert syntax like "-{-{}-}-" * (bug 16281) Show copyright system message on special pages * Upload license preview now uses the API instead of action=ajax +* (bug 7346) Add to RSS to avoid duplicates === Bug fixes in 1.16 === diff --git a/includes/Feed.php b/includes/Feed.php index 0289a6b916..782b64283b 100644 --- a/includes/Feed.php +++ b/includes/Feed.php @@ -43,6 +43,8 @@ class FeedItem { var $Url = ''; var $Date = ''; var $Author = ''; + var $UniqueId = ''; + var $RSSIsPermalink; /**#@-*/ /** @@ -59,6 +61,8 @@ class FeedItem { $this->Title = $Title; $this->Description = $Description; $this->Url = $Url; + $this->UniqueId = $Url; + $this->RSSIsPermalink = false; $this->Date = $Date; $this->Author = $Author; $this->Comments = $Comments; @@ -76,6 +80,28 @@ class FeedItem { return htmlspecialchars( $string ); } + /** + * Get the unique id of this item + * + * @return String + */ + public function getUniqueId() { + if ( $this->UniqueId ) { + return $this->xmlEncode( $this->UniqueId ); + } + } + + /** + * set the unique id of an item + * + * @param $uniqueId String: unique id for the item + * @param $RSSisPermalink Boolean: set to true if the guid (unique id) is a permalink (RSS feeds only) + */ + public function setUniqueId($uniqueId, $RSSisPermalink = False) { + $this->UniqueId = $uniqueId; + $this->RSSIsPermalink = $isPermalink; + } + /** * Get the title of this item; already xml-encoded * @@ -139,7 +165,7 @@ class FeedItem { public function getComments() { return $this->xmlEncode( $this->Comments ); } - + /** * Quickie hack... strip out wikilinks to more legible form from the comment. * @@ -277,6 +303,7 @@ class RSSFeed extends ChannelFeed { <?php print $item->getTitle() ?> getUrl() ?> + RSSIsPermalink ) print ' isPermaLink="true"' ?>>getUniqueId() ?> getDescription() ?> getDate() ) { ?>formatTime( $item->getDate() ) ?> getAuthor() ) { ?>getAuthor() ?> @@ -359,7 +386,7 @@ class AtomFeed extends ChannelFeed { global $wgMimeType; ?> - getUrl() ?> + getUniqueId() ?> <?php print $item->getTitle() ?> getDate() ) { ?>