concrete5/concrete5 — pull request #460 by tlebel (2012-03-17 05:26:33+00:00)
Title: Implementation of page_content cache versioning based on allowed GET params

This addition allows to have a functional full page cache when using the Mobile Theme Switcher Add-On - (http://www.concrete5.org/marketplace/addons/mobile-theme-switcher/).

It basically checks for GET parameters in the query string against an allowed list of GET variables contained in the PAGE_CONTENT_CACHE_ALLOWED_GET_VARS constant. Here is some doc about the new constant:

PAGE_CONTENT_CACHE_ALLOWED_GET_VARS
List of GET parameters that should be taken into account when caching a page. If the parameter is found in the $_GET array, a distinct version of the page will be cached.

For instance, if /my-page is my standard page and /my-page?mobile=1 is the same page but with a mobile template applied (see Mobile Theme Switcher Add-On - http://www.concrete5.org/marketplace/addons/mobile-theme-switcher/), putting 'cid,mobile' will allow to cache the mobile version of the page too.

The value after the allowed GET parameter is ignored. The previous example would render the same cached version for /my-page?mobile=1, /my-page?mobile=2, /my-page?mobile=myvalue, etc.

Default value: cid

To enable cache for Mobile Theme Switcher Add-On, add the following in your /config/site.php
define('PAGE_CONTENT_CACHE_ALLOWED_GET_VARS', 'cid,mobile');