Currently, views_rss.module has a hard exit at the end of its theme function. This prevents drupal's cache mechanism from caching any view-generated feeds, which can have serious performance implications: every time a view feed is hit, it's as if a logged-in user requested the page!
This patch solves this by removing the hard exit, and doing a bit of output checking around returns in theme_views_view () and views_build_view().
I'm not super-proud of the fix in theme_views_view, which basically tracks the output of the specific theme function (e.g. the RSS function, which is returning nothing) as a separate variable, and then checks that at the end. This could be done cleaner -- e.g. working like the change in views_build_view -- but that would require re-working the way the function builds up the $output.
Anyway, submitted for your consideration...
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | views_rss_cacheable-v3.patch | 2.76 KB | suganyaM |
| #2 | views_rss_cacheable-v2.patch | 2.57 KB | populist |
| views_rss_cacheable.patch | 2.57 KB | joshk |
Comments
Comment #1
sami_k commented+1 This is definitely needed for views_rss!
Comment #2
populist commentedVery helpful for improving RSS/Views performance. Slight modification to your patch to pass output text to correct variable:
Change:
+ $views_output .= views_theme('views_view', $view, $type, $items, $info['level'], $args)
With:
+ $output .= views_theme('views_view', $view, $type, $items, $info['level'], $args);
Comment #3
joshk commentedThanks for the catch. I must have made that patch vs. an interum copy before I realized I didn't need to use a separate $views_output var in views_build_view().
Comment #4
sirkitree commented+1
Comment #5
moshe weitzman commentedComment #6
sunMarking as duplicate of #231424: RSS feeds from views bypass the page cache
Comment #7
sunComment #8
suganyaM commentedI did tried this patch. But its not working. can any one help pls
Comment #9
suganyaM commentedGreat Job.
The patch works perfects for me. The previous post was by my mistake.
A white blank page is shown if there no content from output. The above patches discards the Empty text content that is provided in the view. I have included a check to validate the Empty text content. If there is no Empty text, a white page is displayed.