Index: openacs-4/packages/forums/tcl/forums-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-procs.tcl,v diff -u -r1.34 -r1.35 --- openacs-4/packages/forums/tcl/forums-procs.tcl 9 Jul 2018 08:56:29 -0000 1.34 +++ openacs-4/packages/forums/tcl/forums-procs.tcl 9 Jul 2018 09:20:33 -0000 1.35 @@ -80,7 +80,7 @@ callback forum::forum_edit -package_id [ad_conn package_id] -forum_id $forum_id } - forum::flush_templating_cache \ + forum::flush_cache \ -forum_id $forum_id } @@ -127,6 +127,15 @@ } } +ad_proc -public forum::flush_cache { + {-forum_id:required} +} { + Flushes all the forum caches. +} { + forum::flush_templating_cache -forum_id $forum_id + forum::flush_namespaced_cache -forum_id $forum_id +} + ad_proc -public forum::flush_templating_cache { {-forum_id:required} } { @@ -137,6 +146,14 @@ template::cache flush "messages,forum_id=$forum_id*" } +ad_proc -public forum::flush_namespaced_cache { + {-forum_id:required} +} { + Unsets namespaced thread variable holding the forum cache +} { + unset -nocomplain ::forum_${forum_id} +} + ad_proc -deprecated -public forum::posting_policy_set { {-posting_policy:required} {-forum_id:required} Index: openacs-4/packages/forums/tcl/messages-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/messages-procs.tcl,v diff -u -r1.55 -r1.56 --- openacs-4/packages/forums/tcl/messages-procs.tcl 28 Jun 2018 15:27:42 -0000 1.55 +++ openacs-4/packages/forums/tcl/messages-procs.tcl 9 Jul 2018 09:20:33 -0000 1.56 @@ -72,6 +72,9 @@ } } + forum::flush_cache \ + -forum_id $forum_id + return $message_id } @@ -256,6 +259,10 @@ [list message_id $message_id] \ [list state $state]] package_exec_plsql -var_list $var_list forums_message set_state + # flush the forum cache to update the thread count + forum::flush_cache -forum_id [db_string get_forum { + select forum_id from forums_messages where message_id = :message_id + }] } ad_proc -public forum::message::reject { @@ -288,11 +295,11 @@ callback forum::message_delete -package_id [ad_conn package_id] -message_id $message_id } - if { [forum::use_ReadingInfo_p] && - [db_0or1row is_root { - select 1 from forums_messages - where message_id = :message_id - and parent_id is null}]} { + forum::message::get -message_id $message_id -array msg + set forum_id $msg(forum_id) + set is_root_p [expr {$msg(parent_id) eq ""}] + + if { $is_root_p && [forum::use_ReadingInfo_p] } { set db_antwort [db_string forums_reading_info__remove_msg { select forums_reading_info__remove_msg (:message_id); }] @@ -304,6 +311,9 @@ # Remove the message set var_list [list [list message_id $message_id]] package_exec_plsql -var_list $var_list forums_message delete_thread + + # flush the forum cache to update the thread count + forum::flush_cache -forum_id $forum_id } }