Hi,

I just have installed boost module, and the splash page is not working anymore (I suspect boost to put in cache the redirection, but not the splash page).

Is it possible to use splash module with boost ?

Thanks,

Hugo

Comments

mikeytown2’s picture

Here to help if needed... never used splash before

sitiveni’s picture

I played around a bit with splash when boost was enabled. I figured that hook_init is executed and thus it will be determined whether the splash has to be displayed or not. Only thing is that whenever a boost cached page exists, the cached page will be displayed (hence no splash). The other way round (no cached page exists, so a cached page is created with the splash JS enclosed - what is not exactly what we're looking for, now is it?).

So, I figured that boost needs to be manually controlled within splash. This is what I came up with:

  // Show splash
  if ($splash) {
    // Flush boost cached file and don't cache it now
    boost_cache_expire_by_filename(array(request_uri()));
    $GLOBALS['_boost_cache_this'] = FALSE;

    /*** THE WHAT ***/
    ...

I added this just before splash decides how to display the splash. At this stage it is clear that we wan't that the splash appears.
First, an existing cached page is removed (boost_cache_expire_by_filename) so that the request is not served by cache. Then, the appropriate boost flag ($GLOBALS['_boost_cache_this']) is set to avoid caching the page with enclosed splash JS.

So, boost experts out there, I'd like to have your opinion if this approach is somehow feasible or if I'm totally wrong.

Another note on that, I actually was looking for a way to exclude programmatically a page from boost cache on request. So instead of removing the physically cached page, just don't serve it from there. Any ideas there?

sitiveni’s picture

Well, I figured that by using boost's boost_set_cookie() function, it is possible to keep the cached HTML page but serving the current request (when splash has to be shown) from PHP.

  // Show splash
  if ($splash) {
    // Only for anonymous users and when boost enabled.
    // Set special boost cookie to prevent authenticated users getting served pages from the static page cache.
  	if (user_is_anonymous() && module_exists('boost')) {
    	boost_set_cookie(0, 1);
    }
    
    /*** THE WHAT ***/
    ...

I'm calling function boost_set_cookie() with anonymous user id and set the expiry to 1 in order to remove the cookie asap. My tests turned out to be successful, the cached HTML page remains in the cache folder and the page is showing the splash.

So, you boost master out there, let me know what you think of that. Thanks

joelstein’s picture

Title: Boost module and splah module ? » Boost module and Splash

That didn't work for me. Well, it kept the Splash page from getting cached, yes. But when I visited the actual homepage, that got cached. Now, everyone who hits the homepage gets my cached homepage, because the Boost rules in .htaccess find my cached homepage and serve it up before Splash gets a chance to tell it not to.

One possible solution would be to check for the Splash cookie in an .htaccess file, and bypass Boost if the cookie does not exist.

Still another solution is to exclude the homepage altogether from Boost. That definitely works, though you immediately lose a huge performance benefit of using Boost, since the most trafficked page on a site is usually the homepage.

aze2010’s picture

subscribing very urgent! Doesnt work with Boost all the years :-(