r61090 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61089‎ | r61090 | r61091 >
Date:18:00, 15 January 2010
Author:simetrical
Status:ok
Tags:
Comment:
Add <guid> to RSS to avoid duplicates

Bug 7346. Patch by Jools Wills (buzz).
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Feed.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Feed.php
@@ -43,6 +43,8 @@
4444 var $Url = '';
4545 var $Date = '';
4646 var $Author = '';
 47+ var $UniqueId = '';
 48+ var $RSSIsPermalink;
4749 /**#@-*/
4850
4951 /**
@@ -59,6 +61,8 @@
6062 $this->Title = $Title;
6163 $this->Description = $Description;
6264 $this->Url = $Url;
 65+ $this->UniqueId = $Url;
 66+ $this->RSSIsPermalink = false;
6367 $this->Date = $Date;
6468 $this->Author = $Author;
6569 $this->Comments = $Comments;
@@ -77,6 +81,28 @@
7882 }
7983
8084 /**
 85+ * Get the unique id of this item
 86+ *
 87+ * @return String
 88+ */
 89+ public function getUniqueId() {
 90+ if ( $this->UniqueId ) {
 91+ return $this->xmlEncode( $this->UniqueId );
 92+ }
 93+ }
 94+
 95+ /**
 96+ * set the unique id of an item
 97+ *
 98+ * @param $uniqueId String: unique id for the item
 99+ * @param $RSSisPermalink Boolean: set to true if the guid (unique id) is a permalink (RSS feeds only)
 100+ */
 101+ public function setUniqueId($uniqueId, $RSSisPermalink = False) {
 102+ $this->UniqueId = $uniqueId;
 103+ $this->RSSIsPermalink = $isPermalink;
 104+ }
 105+
 106+ /**
81107 * Get the title of this item; already xml-encoded
82108 *
83109 * @return String
@@ -139,7 +165,7 @@
140166 public function getComments() {
141167 return $this->xmlEncode( $this->Comments );
142168 }
143 -
 169+
144170 /**
145171 * Quickie hack... strip out wikilinks to more legible form from the comment.
146172 *
@@ -277,6 +303,7 @@
278304 <item>
279305 <title><?php print $item->getTitle() ?></title>
280306 <link><?php print $item->getUrl() ?></link>
 307+ <guid<?php if( $item->RSSIsPermalink ) print ' isPermaLink="true"' ?>><?php print $item->getUniqueId() ?></guid>
281308 <description><?php print $item->getDescription() ?></description>
282309 <?php if( $item->getDate() ) { ?><pubDate><?php print $this->formatTime( $item->getDate() ) ?></pubDate><?php } ?>
283310 <?php if( $item->getAuthor() ) { ?><dc:creator><?php print $item->getAuthor() ?></dc:creator><?php }?>
@@ -359,7 +386,7 @@
360387 global $wgMimeType;
361388 ?>
362389 <entry>
363 - <id><?php print $item->getUrl() ?></id>
 390+ <id><?php print $item->getUniqueId() ?></id>
364391 <title><?php print $item->getTitle() ?></title>
365392 <link rel="alternate" type="<?php print $wgMimeType ?>" href="<?php print $item->getUrl() ?>"/>
366393 <?php if( $item->getDate() ) { ?>
Index: trunk/phase3/RELEASE-NOTES
@@ -303,6 +303,7 @@
304304 * LanguageConverter now support nested using of manual convert syntax like "-{-{}-}-"
305305 * (bug 16281) Show copyright system message on special pages
306306 * Upload license preview now uses the API instead of action=ajax
 307+* (bug 7346) Add <guid> to RSS to avoid duplicates
307308
308309 === Bug fixes in 1.16 ===
309310

Status & tagging log