Item10715: Doesn't work well with cache

pencil
Priority: Enhancement
Current State: New
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: WorkflowPlugin
Branches:
Reported By: AndrewJones
Waiting For:
Last Change By: MichaelDaum
When changing state, the built-in cache doesn't get updated, so the page doesn't change.

This can probably be fixed by adding refresh=cache to the redirect urls.


Or maybe, it was related to other problems I was having.

A simple test:

  • enable cache
  • go to the examples in Sandbox
  • run through the states until you get past the one which does not give you the edit screen

If the page doesn't change, then it is because the cache isn't getting refreshed. Suggested patch:

Index: WorkflowPlugin/lib/Foswiki/Plugins/WorkflowPlugin.pm
===================================================================
--- WorkflowPlugin/lib/Foswiki/Plugins/WorkflowPlugin.pm        (revision 11634)
+++ WorkflowPlugin/lib/Foswiki/Plugins/WorkflowPlugin.pm        (working copy)
@@ -407,7 +408,7 @@
                 # Flag that this is a state change to the beforeSaveHandler
                 local $isStateChange = 1;
                 $controlledTopic->save();
-                $url = Foswiki::Func::getScriptUrl( $web, $topic, 'view' );
+                $url = Foswiki::Func::getScriptUrl( $web, $topic, 'view', refresh => 'cache' );
             }
 
             Foswiki::Func::redirectCgiQuery( undef, $url );

-- AndrewJones - 05 May 2011

A save() should always trigger a cache refresh by itself, i.e. for the page being saved. The other potential reason why $web.$topic isn't refreshed by $controlledTopic being saved is that they are different topics with no dependency between them. So to let a save of $controlledTopic refresh $web.$topic automatically you'd best establish a dependency between them using $controlledTopic->addDependency($web, $topic); at the time data from $controlledTopic was used to render the page for $web.$topic.

-- MichaelDaum - 08 May 2011
 

ItemTemplate edit

Summary Doesn't work well with cache
ReportedBy AndrewJones
Codebase
SVN Range
AppliesTo Extension
Component WorkflowPlugin
Priority Enhancement
CurrentState New
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
Topic revision: r3 - 08 May 2011, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy