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 -r1.6 -r1.7 --- openacs-4/packages/news-aggregator/news-aggregator.info 20 Mar 2004 11:12:28 -0000 1.6 +++ openacs-4/packages/news-aggregator/news-aggregator.info 20 Mar 2004 13:21:00 -0000 1.7 @@ -8,14 +8,14 @@ f na - - Guan Yang + Simon Carstensen + Guan Yang Read news sources from your website. 2004-03-20 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/tcl/source-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/source-procs-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/news-aggregator/tcl/source-procs-postgresql.xql 20 Mar 2004 11:04:39 -0000 1.1 +++ openacs-4/packages/news-aggregator/tcl/source-procs-postgresql.xql 20 Mar 2004 13:21:00 -0000 1.2 @@ -29,11 +29,17 @@ from na_sources where last_scanned < (now() - '00:48:00'::time) order by last_scanned asc - limit $limit + $limit_sql + + + limit $limit + + + select guid, original_guid, i.title, i.description 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 -r1.1 -r1.2 --- openacs-4/packages/news-aggregator/tcl/source-procs.tcl 20 Mar 2004 11:04:39 -0000 1.1 +++ openacs-4/packages/news-aggregator/tcl/source-procs.tcl 20 Mar 2004 13:21:00 -0000 1.2 @@ -40,9 +40,9 @@ } array set channel $result(channel) - set title [string_truncate -len 500 -no_format -- $channel(title)] - set link [string_truncate -len 500 -no_format -- $channel(link)] - set description [string_truncate -len 500 -no_format -- $channel(description)] + set title [string_truncate -len 500 -- $channel(title)] + set link [string_truncate -len 500 -- $channel(link)] + set description [string_truncate -len 500 -- $channel(description)] set source_id [db_nextval "acs_object_id_seq"] set creation_ip [ad_conn peeraddr] @@ -60,9 +60,9 @@ foreach array $items { array set item $array - set title [string_truncate -len 500 -no_format -- $item(title)] - set link [string_truncate -len 500 -no_format -- $item(link)] - set guid [string_truncate -len 500 -no_format -- $item(guid)] + set title [string_truncate -len 500 -- $item(title)] + set link [string_truncate -len 500 -- $item(link)] + set guid [string_truncate -len 500 -- $item(guid)] set permalink_p $item(permalink_p) set description $item(description) set content_encoded $item(content_encoded) @@ -168,9 +168,9 @@ foreach array $items { array set item $array - set title [string_truncate -len 500 -format html -no_format -- $item(title)] - set link [string_truncate -len 500 -no_format -- $item(link)] - set original_guid [string_truncate -len 500 -no_format -- $item(guid)] + set title [string_truncate -len 500 -- $item(title)] + set link [string_truncate -len 500 -- $item(link)] + set original_guid [string_truncate -len 500 -- $item(guid)] set permalink_p $item(permalink_p) set content_encoded $item(content_encoded) set description $item(description) @@ -255,17 +255,32 @@ db_exec_plsql delete_source {} } -ad_proc -public news_aggregator::source::update_all {} { - @author Simon Carstensen +ad_proc -public news_aggregator::source::update_all { + -all_sources:boolean +} { + @author Simon Carstensen (simon@bcuni.net) + @author Guan Yang (guan@unicast.org) Update sources by a one hour interval. + + @param all_sources Update every source. Normally this proc + will only update the 25% of the existing sources. } { ns_log Notice "Updating news aggregator sources" + ds_comment "test" db_transaction { set source_count [db_string source_count ""] if { $source_count >= 1 } { - set limit [expr int($source_count/4)] + if { !$all_sources_p } { + set limit [expr int($source_count/4)] + if { $limit < 1 } { + set limit 1 + } + set limit_sql [db_map sources_limit] + } else { + set limit_sql "" + } set sources [db_list_of_lists sources ""] foreach source $sources { set source_id [lindex $source 0] Index: openacs-4/packages/news-aggregator/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/index.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/news-aggregator/www/index.adp 20 Mar 2004 11:12:29 -0000 1.5 +++ openacs-4/packages/news-aggregator/www/index.adp 20 Mar 2004 13:21:01 -0000 1.6 @@ -41,7 +41,7 @@ - @items.content@ + @items.content;noquote@ #