Index: openacs-4/packages/workflow/tcl/case-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/tcl/case-procs-postgresql.xql,v diff -u -r1.11 -r1.12 --- openacs-4/packages/workflow/tcl/case-procs-postgresql.xql 28 Feb 2011 14:21:12 -0000 1.11 +++ openacs-4/packages/workflow/tcl/case-procs-postgresql.xql 17 Sep 2013 14:37:38 -0000 1.12 @@ -63,7 +63,7 @@ iou.last_name as user_last_name, iou.email as user_email, io.creation_date, - to_char(io.creation_date, 'Mon FMDD, YYYY FMHH12:MI:SS AM') as creation_date_pretty, + to_char(io.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_pretty, r.content as comment_string, r.mime_type as comment_mime_type, d.key, Index: openacs-4/packages/workflow/tcl/case-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/tcl/case-procs.tcl,v diff -u -r1.46 -r1.47 --- openacs-4/packages/workflow/tcl/case-procs.tcl 28 Feb 2011 14:21:13 -0000 1.46 +++ openacs-4/packages/workflow/tcl/case-procs.tcl 17 Sep 2013 14:37:38 -0000 1.47 @@ -836,7 +836,7 @@ return 3600 } -ad_proc -private workflow::case::flush_cache { +ad_proc -private workflow::case::flush_cache0 { {-case_id ""} } { Flush all cached data for a given case or for all @@ -859,10 +859,46 @@ util_memoize_flush_regexp [list workflow::case::get_activity_log_info_not_cached -case_id $case_id] # Flush role info (assignees etc) + workflow::case::role::flush_cache0 -case_id $case_id +} + +ad_proc -private workflow::case::flush_cache { + {-case_id ""} +} { + Flush all cached data for a given case or for all + cases if none is specified. + + @param case_id The id of the workflow case to flush. If not provided the + cache will be flushed for all workflow cases. + + @author Peter Marklund +} { + foreach proc_name { + workflow::case::fsm::get_info_not_cached + workflow::case::get_user_roles_not_cached + workflow::case::get_enabled_action_ids_not_cached + } { + if {$case_id eq ""} { + util_memoize_flush_pattern "$proc_name *" + } else { + util_memoize_flush_pattern "$proc_name $case_id *" + } + } + + if {$case_id eq ""} { + util_memoize_flush_pattern "workflow::case::get_activity_log_info_not_cached -case_id *" + util_memoize_flush_pattern "workflow::case::get_enabled_actions_not_cached *" + } else { + util_memoize_flush "workflow::case::get_activity_log_info_not_cached -case_id $case_id" + util_memoize_flush "workflow::case::get_enabled_actions_not_cached $case_id" + } + + # Flush role info (assignees etc) workflow::case::role::flush_cache -case_id $case_id } + ad_proc -public workflow::case::timed_actions_sweeper {} { Sweep for timed actions ready to fire. } { @@ -888,6 +924,7 @@ # Select the info into the upvar'ed Tcl Array upvar $array row + db_1row select_enabled_action {} -column_array row } @@ -1178,7 +1215,7 @@ return $result } -ad_proc -private workflow::case::role::flush_cache { +ad_proc -private workflow::case::role::flush_cache0 { {-case_id ""} } { Flush all role related info for a certain case or for all @@ -1187,6 +1224,19 @@ util_memoize_flush_regexp "^workflow::case::role::get_assignees_not_cached [ad_decode $case_id "" {\.*} $case_id]" } +ad_proc -private workflow::case::role::flush_cache { + {-case_id ""} + } { + Flush all role related info for a certain case or for all + cases if none is specified. +} { + if {$case_id eq ""} { + util_memoize_flush_pattern "workflow::case::role::get_assignees_not_cached *" + } else { + util_memoize_flush_pattern "workflow::case::role::get_assignees_not_cached $case_id *" + } +} + ad_proc -public workflow::case::role::assignee_insert { {-case_id:required} {-role_id:required} @@ -1498,6 +1548,7 @@ } if { ![empty_string_p $enabled_action_id] } { + ns_log notice "#### workflow::case::enabled_action_get -enabled_action_id $enabled_action_id -array enabled_action" workflow::case::enabled_action_get -enabled_action_id $enabled_action_id -array enabled_action set case_id $enabled_action(case_id) set action_id $enabled_action(action_id) @@ -2017,7 +2068,7 @@ if { [empty_string_p $comment_mime_type] } { set comment_mime_type "text/plain" } - + ns_log notice "case::execute start = [set start [clock clicks -milliseconds]]" db_transaction { # Double-click protection @@ -2034,14 +2085,14 @@ -case_id $case_id \ -action_id $action_id \ -parent_enabled_action_id $parent_enabled_action_id - + ns_log notice "case::execute two = [expr {[set two [clock clicks -milliseconds]] - $start}]" # Mark the action completed if { ![empty_string_p $enabled_action_id] } { workflow::case::action::complete \ -enabled_action_id $enabled_action_id \ -user_id $user_id } - + ns_log notice "case::execute three = [expr {[set three [clock clicks -milliseconds]] - $two}]" # Insert activity log entry set extra_vars [ns_set create] oacs_util::vars_to_ns_set \ @@ -2061,15 +2112,15 @@ -case_id $case_id \ -action_id $action_id \ -entry_id $entry_id - + ns_log notice "case::execute five = [expr {[set five [clock clicks -milliseconds]] - $three}]" # Scan for enabled actions if { [string equal $parent_trigger_type "workflow"] } { workflow::case::state_changed_handler \ -case_id $case_id \ -parent_enabled_action_id $parent_enabled_action_id \ -user_id $user_id } - + ns_log notice "case::execute six = [expr {[set six [clock clicks -milliseconds]] - $five}]" # Notifications if { !$no_notification_p } { workflow::case::action::notify \ @@ -2079,17 +2130,18 @@ -comment $comment \ -comment_mime_type $comment_mime_type } - + ns_log notice "case::execute seven = [expr {[set seven [clock clicks -milliseconds]] - $six}]" # If there's a parent, alert the parent if { ![empty_string_p $parent_enabled_action_id] } { workflow::case::child_state_changed_handler \ -parent_enabled_action_id $parent_enabled_action_id \ -user_id $user_id } } - + ns_log notice "case::execute eight = [expr {[set eight [clock clicks -milliseconds]] - $seven}]" workflow::case::flush_cache -case_id $case_id - + ns_log notice "case::execute nine = [expr {[set nine [clock clicks -milliseconds]] - $eight}]" + ns_log notice "case::execute end = [expr {[set end [clock clicks -milliseconds]] - $start}]" return $entry_id }