I use Boost on my site, and I have seen a strange issue. I have a view with a pager which consists of a listing of nodes. When I update the status of one of the nodes to unpublished, all cached pages of the view are removed, which is the expected behaviour. This is also to be seen from the watchdog:
Debug: boost_expire_node() <br />Node 67 was flushed resulting in 3 pages being expired from the cache
Then I access each of the pages in the pager and the cache is recreated for each of them. After that I change the status of the node in question to published again and, the cached pages unfortunately do not get removed from the cache directory.
Debug: boost_expire_node() <br />Node 67 was flushed resulting in 0 pages being expired from the cache
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | boost-743992.patch | 2.81 KB | mikeytown2 |
| #11 | boost.issue_publish_on_update.patch | 1.21 KB | koenvi |
| #5 | boost-743992.patch | 2.97 KB | mikeytown2 |
Comments
Comment #1
egd commentedI guess the problem comes from the fact that boost_cache_get_node_relationships() searches for the node in the boost_* tables, where the node is _not_ to be found in the second case. Shouldn't we look for it in the original views datasets?
Comment #2
mikeytown2 commentedBoost only does this when a node is inserted; for most use cases, this is ok since the node gets published when it gets submitted. Looks like I need to detect if the node went from
not publishedtopublished& if that happens search all views for that node. If I search every view every time the node gets updated, that could be quite slow, so I should only do it when the published state switches.Hopefully this can be done in the presave or validate operation of hook_nodeapi()... looking at it validate seems like the winner.
Comment #3
egd commentedmikeytown2 I am willing to attempt to make the fix. Even though I am not new to programming I am new to Drupal and php. I would appreciate if you give me some more detail about an eventual fix.
I got stuck where I had to find out in which views a particular nid is contained. Any help will be appreciated.
Comment #4
mikeytown2 commentedin boost_nodeapi
run this to test if the node is in a view
You can see an example with
case 'insert':.EDIT: grabbed the wrong example code; now calls the correct function.
I should probably make $GLOBALS['_boost_nid'] be an array since I could see more then 1 node being inserted at a time (feeds).
Comment #5
mikeytown2 commentedLooking for the difference between whats in the database and the new values could become a nightmare. Taking the easy route on this one. Node saves with this enabled are not as fast as they could be, but it's still pretty quick.
Comment #6
mikeytown2 commentedcommitted
Comment #7
egd commentedUnfortunately, it still does not work. I reopened the issue.
When the node is published and you un-publish it, all cached pages of the view are deleted. This is OK.
When the node is not published and you publish it the cached pages are not deleted. This is not OK.
I still think that the statement in #1 holds true, and the way you attempted to fix the issue is not right.
Comment #8
mikeytown2 commentedJust to be certain did you enable a new setting "Clear all cached views pages associated with a node on update"?
Comment #9
egd commentedYes.
Comment #10
mikeytown2 commentedare you using feeds for the node?
http://drupal.org/node/779184
Comment #11
koenvi commentedHi all,
I had noticed the same issue so I created a small patch to fix this. The patch is pretty simple and only includes 2 changes the boost_nodeapi:
- case 'load': save the old status to the request
- case 'update': check if the status changed from unpublished (0) to published (1). If yes, then execute the same code as for the insert operator
I tested it and it works fine for me.
Comment #12
mikeytown2 commentedI've come up with some experimental code that detects what parts of the node object has changed. Works ok from what I can tell. Could use this for very smart cache invalidation. Works with CCK & base level node objects; doesn't work with things that are buried deep like nodewords (meta tags) settings. Could use this as a framework where different changes to the node object result in different cache expiration logic.
Code is copy paste hackish; proof of concept at this point. Figuring out what has changed in the node object is not an easy task.
Comment #13
mikeytown2 commented