Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
views_cache_bully_view_is_exempt()
tests the inited
property of a view before calling the Views method uses_exposed()
. Apparently blocks created by the Views modules on our test installation do not have the inited
property set at all, but do have the uses_exposed()
method defined. This way this module falsely sends error messages to watchdog.
My patch is the following: instead of testing the inited
property, test the existence of the uses_exposed()
method:
// old test: if (empty($view->inited)) {
if (empty($view->display[$view->current_display]->handler) || !method_exists($view->display[$view->current_display]->handler, 'uses_exposed')) {
watchdog('views_cache_bully', 'Error, Views Cache Bully could not evaluate view exemption for view @view_name, view was not initialized.', array('@view_name' => $view->name));
}
Comment | File | Size | Author |
---|---|---|---|
#6 | views_cache_bully-check_uses_exposed.patch | 814 bytes | tenken |
Comments
Comment #0.0
lmeurs CreditAttribution: lmeurs commentedAdded remark about errors being falsely sent to watchdog.
Comment #1
dstolI tried for a while to reproduce this, but failed. It'd be helpful if you could spin up a vanilla drupal install and provide a database dump or maybe just a view export that illustrates this issue.
Comment #2
lmeurs CreditAttribution: lmeurs commentedThank you for your reaction and time! Unfortunately I do not recall the site I was working on, so I cannot test the specific project. I did write down a note to myself that #2076273: Notice: undefined index view_name in views_cache_bully_view_is_exempt... might have been a duplicate, after the latest update of the module I did not reapply the changes I suggested in the original post. So far so good, but since error messages were being sent to watchdog possible errors can easily remain unnoticed for a while... Thanks again!
Comment #3
webservant316 CreditAttribution: webservant316 commentedoh yeah, just ran into this problem. My logs were filling up with this view cache bully warning...
The code snippet above worked for me.
The problem is easily reproduced. Just create a view block and attach the view block to a node.
Comment #4
webservant316 CreditAttribution: webservant316 commentedAs soon as some makes the fix into a patch we could head toward RTBC.
Comment #5
tenken CreditAttribution: tenken as a volunteer commentedI am experiencing the same issue on a large website. The solution appears to work for me as well.
Comment #6
tenken CreditAttribution: tenken as a volunteer commentedAttached patch that resolves issue for me from thread. Thanks lmeurs for the solution!
Comment #7
SaytO CreditAttribution: SaytO at Metadrop commentedThis patch works for me, step to reviewed.
Although given that is not updated since 16 January 2014 I do not think that we we will see in a new version. hurts
But still remains hope step to tested by the community
Comment #9
dstolComment #10
dstolThanks for the patch!
Comment #11
lmeurs CreditAttribution: lmeurs commentedGreat news! But would have loved to be credited in the commit too... :-)
Comment #12
dstolMy bad! Still appreciate your effort!