If the form cache is not in sync with the page cache, the AuthcacheFormBuildid can not return a new Buildid. The result is that nothing happens when users press the submit button on a form.
This should of course not happen, but we have had this several times while testing, debugging and building test scripts.
Attached patch tries to rebuild a new authcache template form and renames it to the originally requested form_build_id.
| Comment | File | Size | Author |
|---|---|---|---|
| recover_form_cache.patch | 1.83 KB | batje |
Comments
Comment #1
znerol commentedThanks, this is great.
What is the reason behind explicitly including those files when drupal gets bootstrapped after that anyway? Looking at _drupal_bootstrap_full it seems to me that those files should be loaded anyway? Also are you sure that the calls to
module_load_all_includesandmodule_load_allreally are required before the bootstrap?Comment #2
znerol commentedAnd now I remember why I left that bit out for the moment. There is another catch with this approach. Some forms need arguments. In those cases we need to supply the original arguments to drupal_get_form in order to be able to reproduce them completely.
Comment #3
batje commentedfair point. we didn't have that scenario.
Comment #4
znerol commentedI found a way to get around the hard-coded 6h expiration time for
cache_formentries. I've published a little helper module providing a cache-class capable of intercepting calls tocache_get,cache_setandcache_clear. Whenever one of those functions is called, the hookshook_cacheobject_load,hook_cacheobject_presaveandhook_cacheobject_clearget invoked. Implementors then have a chance to mess with the cache-object, i.e. alter the expiry-time etc.When the Cache Object API module is present,
authcache_formnow will expose an option to set the expiry time for form prototypes held in the form cache.Commit: 6142125