Index: openacs-4/packages/rss-support/tcl/rss-generation-service-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/tcl/rss-generation-service-procs.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/rss-support/tcl/rss-generation-service-procs.tcl 11 Nov 2001 05:35:21 -0000 1.5 +++ openacs-4/packages/rss-support/tcl/rss-generation-service-procs.tcl 30 Nov 2001 05:56:37 -0000 1.6 @@ -9,9 +9,9 @@ db_foreach timed_out_subscriptions { select r.subscr_id, - i.impl_name, - r.summary_context_id, r.timeout, + r.summary_context_id, + i.impl_name, case when r.lastbuild = null then 0 else date_part('epoch',r.lastbuild) @@ -26,34 +26,67 @@ $summary_context_id $impl_name] if { $lastupdate > $lastbuild } { # Old report is stale. Build a new one. - set datasource [acs_sc_call RssGenerationSubscriber datasource \ - $summary_context_id $impl_name] - set args "" - foreach {name val} $datasource { - append args "-$name \"$val\" " - } - set xml [apply rss_gen $args] - set report_dir [ns_info pageroot]/[ad_parameter -package_id [rss_package_id] RssGenOutputDirectory rss-support rss]/$impl_name/${summary_context_id} + rss_gen_report $subscr_id + incr n + } + } - # Create directory if needed. - rss_assert_dir $report_dir + ns_log Debug "rss_gen_service: built $n reports" - # Write report. - set fh [open $report_dir/rss.xml w] - puts $fh $xml - close $fh +} - db_dml update_timestamp { - update rss_gen_subscrs - set lastbuild = now() - where subscr_id = :subscr_id - } - incr n +ad_proc -private rss_gen_report subscr_id { +
+    # Build a report, write it out, log it.
+    
+} { + set start [clock seconds] + + db_1row subscr_info { + select i.impl_name, + r.summary_context_id + from acs_sc_impls i, + rss_gen_subscrs r + where r.subscr_id = :subscr_id + and i.impl_id = r.impl_id + } + + set datasource [acs_sc_call RssGenerationSubscriber datasource \ + $summary_context_id $impl_name] + set args "" + foreach {name val} $datasource { + append args "-$name \"$val\" " + if { [lsearch [list channel_link channel_title] $name] >= 0 } { + set $name $val } } + set xml [apply rss_gen $args] + set report_dir [ns_info pageroot]/[ad_parameter -package_id [rss_package_id] RssGenOutputDirectory rss-support rss]/$impl_name/${summary_context_id} - ns_log Debug "rss_gen_service: built $n reports" + # Create directory if needed. + rss_assert_dir $report_dir + # Write report. + set fh [open $report_dir/rss.xml w] + puts $fh $xml + close $fh + + # Copy some useful display information into the + # subscriptions table. + set extra_sql "" + foreach col [list channel_title channel_link] { + if [info exists $col] { + append extra_sql ", $col = :$col" + } + } + + set last_ttb [expr [clock seconds] - $start] + db_dml update_timestamp " + update rss_gen_subscrs + set lastbuild = now(), + last_ttb = :last_ttb $extra_sql + where subscr_id = :subscr_id + " } ad_proc -private rss_assert_dir path {