Posted by Vuds on December 17, 2008 at 1:28pm
Jump to:
| Project: | Hierarchical Select |
| Version: | 5.x-3.0-rc7 |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
After discovering the cause of that problem in #266960, I sneaked around all this functions and I was doing tests with a views filter form. I discovered this issue observing the "cache" table, since the hs_form_build_id was not disappearing after submitting the filter.
The #submit function does not affect in filter view, I had tested it.
The bad of this is that the "cache" table can get very big, if you have a great quantity of users, views filters allowed for anonymous users, web crawlers that do searching in your site, and many other situations, lowering performance considerably.
Comments
#1
Are you sure? Then this is a Drupal core bug, because:
<?php
/**
* Hierarchical select form element type #after_build callback.
*/
function hierarchical_select_after_build($form, $form_values) {
// …
// Pass the hs_form_build_id to a custom submit function that will clear
// the associated values from the cache.
$form['#submit']['_hierarchical_select_submit'] = array($_POST['hs_form_build_id']);
return $form;
}
/**
* Hierarchical select form element #submit callback.
*/
function _hierarchical_select_submit($form_id, $form_values, $hs_form_build_id) {
// Delete the stored form information when the form is submitted.
cache_clear_all($hs_form_build_id, 'cache');
}
?>
#2
Closing while cleaning up the issue queue. Feel free to reopen.