Active
Project:
Workflow-ng
Version:
5.x-2.x-dev
Component:
Wng API
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Jan 2008 at 19:29 UTC
Updated:
2 Apr 2008 at 18:22 UTC
If the token cache gets filled by other modules using token, workflow-ng token replacement will make use of this cache. This might lead to getting old token replacements.
Possible fix. Clear the token cache when tokens are replaced the first time by workflow-ng.
However, this won't help in any case. E.g. when multiple events occur on a page load, workflow-ng won't clear the tokens for the second event. Another possible fix would be an action to clear the token cache.
Comments
Comment #1
jbjaaz commentedHere is a scenario where the vid token value is not updating correctly.
I'm using the workflow_ng configuration found at http://drupal.org/node/204277.
When the action is fired, the user is redirected the second to last revision instead of the newly created one. I traced the code and found that the token list was compiled prior to the new revision being saved. When the "redirect to page" action is fired, even though the node object now has the new vid, the previous vid is used instead.
I found a fix by adding
token_get_values('global', NULL, TRUE);to
revision_moderation_nodeapi(), which seemed to do the trick.(snippet)
That solved my problem, but I realize there might be a better way.
Comment #2
fagohmm, thinking more about this. Probably best is the "token clear cache" action.
I don't like clearing the token cache for every invoked event as I'm concerned about the performance. Adding it to the token integration won't work in all cases.
Comment #3
jbjaaz commentedWouldn't this be up to the developer who is integrating workflow_ng into their module?
Providing a "clear token cache" action would require the user/admin to know that tokens are cached and that the problem they are encountering is a caching issue. In my humble opinion, the casual site admin (ie non-drupal developer) shouldn't be expected to deal with this kind of quirk.
I feel like this should be up to the module developers to be aware of the token cache and realize that if one of their tokens change half way, they'll need to update the token cache.
I guess we need the module developers who have integrated workflow_ng/tokens to weigh in. Come forth ye who write modules.
Comment #4
fagohm, unfortunately this isn't really possible. E.g. workflow-ng operates on nodeapi op 'update' - it can't know if another module like auto nodetitle is active and using token...
I don't like the "action solution" however so people have at least a way to sort the caching problem out, if they are affected.
The only other option is to clear the cache for *every* invoked workflow-ng event, but this would result in compiling global tokens for nothing for every event with configurations.. This will seriously affect workflow-ng's performance so this is no real option too.
Comment #5
Leeteq commentedSubscribing.