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]