Index: trunk/phase3/includes/Feed.php |
— | — | @@ -43,6 +43,8 @@ |
44 | 44 | var $Url = ''; |
45 | 45 | var $Date = ''; |
46 | 46 | var $Author = ''; |
| 47 | + var $UniqueId = ''; |
| 48 | + var $RSSIsPermalink; |
47 | 49 | /**#@-*/ |
48 | 50 | |
49 | 51 | /** |
— | — | @@ -59,6 +61,8 @@ |
60 | 62 | $this->Title = $Title; |
61 | 63 | $this->Description = $Description; |
62 | 64 | $this->Url = $Url; |
| 65 | + $this->UniqueId = $Url; |
| 66 | + $this->RSSIsPermalink = false; |
63 | 67 | $this->Date = $Date; |
64 | 68 | $this->Author = $Author; |
65 | 69 | $this->Comments = $Comments; |
— | — | @@ -77,6 +81,28 @@ |
78 | 82 | } |
79 | 83 | |
80 | 84 | /** |
| 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 | + /** |
81 | 107 | * Get the title of this item; already xml-encoded |
82 | 108 | * |
83 | 109 | * @return String |
— | — | @@ -139,7 +165,7 @@ |
140 | 166 | public function getComments() { |
141 | 167 | return $this->xmlEncode( $this->Comments ); |
142 | 168 | } |
143 | | - |
| 169 | + |
144 | 170 | /** |
145 | 171 | * Quickie hack... strip out wikilinks to more legible form from the comment. |
146 | 172 | * |
— | — | @@ -277,6 +303,7 @@ |
278 | 304 | <item> |
279 | 305 | <title><?php print $item->getTitle() ?></title> |
280 | 306 | <link><?php print $item->getUrl() ?></link> |
| 307 | + <guid<?php if( $item->RSSIsPermalink ) print ' isPermaLink="true"' ?>><?php print $item->getUniqueId() ?></guid> |
281 | 308 | <description><?php print $item->getDescription() ?></description> |
282 | 309 | <?php if( $item->getDate() ) { ?><pubDate><?php print $this->formatTime( $item->getDate() ) ?></pubDate><?php } ?> |
283 | 310 | <?php if( $item->getAuthor() ) { ?><dc:creator><?php print $item->getAuthor() ?></dc:creator><?php }?> |
— | — | @@ -359,7 +386,7 @@ |
360 | 387 | global $wgMimeType; |
361 | 388 | ?> |
362 | 389 | <entry> |
363 | | - <id><?php print $item->getUrl() ?></id> |
| 390 | + <id><?php print $item->getUniqueId() ?></id> |
364 | 391 | <title><?php print $item->getTitle() ?></title> |
365 | 392 | <link rel="alternate" type="<?php print $wgMimeType ?>" href="<?php print $item->getUrl() ?>"/> |
366 | 393 | <?php if( $item->getDate() ) { ?> |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -303,6 +303,7 @@ |
304 | 304 | * LanguageConverter now support nested using of manual convert syntax like "-{-{}-}-" |
305 | 305 | * (bug 16281) Show copyright system message on special pages |
306 | 306 | * Upload license preview now uses the API instead of action=ajax |
| 307 | +* (bug 7346) Add <guid> to RSS to avoid duplicates |
307 | 308 | |
308 | 309 | === Bug fixes in 1.16 === |
309 | 310 | |