Index: openacs-4/packages/news-aggregator/news-aggregator.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/news-aggregator.info,v diff -u -N -r1.13 -r1.14 --- openacs-4/packages/news-aggregator/news-aggregator.info 20 Aug 2004 09:31:12 -0000 1.13 +++ openacs-4/packages/news-aggregator/news-aggregator.info 2 Apr 2019 10:42:42 -0000 1.14 @@ -8,17 +8,18 @@ f na - + Guan Yang Simon Carstensen Read news sources from your website. 2004-06-01 The news aggregator periodically reads a set of news sources, in one of several XML-based formats, finds the new bits, and displays them in reverse-chronological order on a single page. - + + Index: openacs-4/packages/news-aggregator/sql/postgresql/upgrade-0.9d-0.10d.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/sql/postgresql/Attic/upgrade-0.9d-0.10d.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/sql/postgresql/upgrade-0.9d-0.10d.sql 2 Apr 2019 10:42:42 -0000 1.1 @@ -0,0 +1,5 @@ +begin; + +ALTER TABLE na_items ADD CONSTRAINT na_items_unique_guid UNIQUE (guid,source_id); + +end; Index: openacs-4/packages/news-aggregator/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/apm-callback-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/tcl/apm-callback-procs.tcl 2 Apr 2019 10:42:42 -0000 1.2 @@ -0,0 +1,42 @@ +ad_library { + APM Callbacks Procs +} + +namespace eval news_aggregator::apm {} + +ad_proc -private news_aggregator::apm::after_upgrade { + {-from_version_name:required} + {-to_version_name:required} +} { + Before upgrade callback +} { + apm_upgrade_logic \ + -from_version_name $from_version_name \ + -to_version_name $to_version_name \ + -spec { + 0.9d 0.10d { + db_transaction { + # Keep only the most recent entry having a certain + # guid.source_id. This combination will have to be + # unique after the upgrade, because we are + # inserting a new constraint. + set key "" + db_foreach get_duplicated_guid_news { + select item_id, guid, source_id + from na_items + order by source_id desc, pub_date desc, creation_date desc + } { + set row_key ${guid}.${source_id} + if {$key eq $row_key} { + db_dml delete_duplicate { + delete from na_items + where item_id = :item_id + } + } else { + set key $row_key + } + } + } + } + } +} Index: openacs-4/packages/news-aggregator/tcl/source-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/source-procs.tcl,v diff -u -N -r1.20 -r1.21 --- openacs-4/packages/news-aggregator/tcl/source-procs.tcl 2 Apr 2019 10:08:43 -0000 1.20 +++ openacs-4/packages/news-aggregator/tcl/source-procs.tcl 2 Apr 2019 10:42:42 -0000 1.21 @@ -167,9 +167,6 @@ set pub_date [clock format $pub_date -format "%Y-%m-%d %T UTC"] } - # Notice: we are assuming source_id,guid is a superkey of - # na_items. This is not technically true, but this upgrade - # strategy should enforce it. set item_exists_p [db_0or1row get_existing_news_item { select title as existing_title, description as existing_description, link as existing_link from na_items