Is there a way to set cache settings for all panes in one hit?
Editors on my site have created a lot of panel nodes without setting cache settings for any of them.
I'd like to update all the panes to use time-based simple caching - is there a better way of doing it than a direct database query?
Comments
Comment #1
sdboyer commentednope, there's no facility for a batch action like that. sorry. a direct db query might be a little tough (given that you have to write to a serialized array), but you could probably do it pretty easily with a short script executed via
drush scr.Comment #2
sdboyer commentedComment #3
malcomio commentedThanks - that's what I ended up doing - here's the function I called via Drush, in case it's useful to anyone else.
Comment #5
Countzero commentedDoes anybody know if there is a way to do this under D7 / Panels 3.3 ?
In the meantime, I'll try to adapt the snippet above to it and post it if it's relevant.
Comment #6
Countzero commentedIf anyone's interested, here's what I came up with. I can't believe this functionality isn't implemented somewhere already, but well.
It's VERY rough. It will enable caching for one week for all panes of all displays on your website, so please use with caution.
Comment #7
Countzero commentedIf anyone has time to review the snippet, feel free. Or maintainers can close, it's up to them.
Comment #8
kmccarthy commentedI, like Malcomio, also have a site with a lot of panes that have never had cache set for them. As this was the only information I could find that addresses a batch modification of them, I looked into following Countzero's suggestion of setting cache via a query directly to the database. However I could only locate panel panes in the data that were not on system pages - i.e. I couldn't find any data for panes set in node_view or term_view pages. After a rather long effort to track that data down I realized I didn't know enough of how CTools stores it and that it would take a considerable amount of time to learn it, time I don't have at the moment, so I took another approach.
Since I have all of the pane configurations set in a Feature module I decided to modify the pane cache settings in that code. It seems to work fine now that I've reverted the Feature to the new code.
Hope this helps someone else looking to do the same.
Comment #9
kmccarthy commentedUpdate on my adventures with panel pane caching: Although it is undoubtedly a pain (pun intended?) to use the UI for setting cache for panes throughout various pages that employ panels, I would highly advise being very careful in batching configuration using any means. Setting values may have unintended consequences unless you know exactly what you want and what the results will be. Using the panels_why_so_slow module has proven to be very helpful for me in applying cache only for the panes where it really helps performance. And I've learned the hard way what selecting 'granularity' does.
Comment #10
japerryDrupal 7 is no longer supported, closing.