I’m trying to find a good way of deploying Hyper Cache.
Background
I deploy my WP sites to a production server with Capistrano. What this does is download the latest version from a git repository, create a dated release folder, and them symlink a folder called current to the latest release folder.
So /var/www/examplesite/current -> /var/www/examplesite/releases/20140609142903
After the next deployment of code, /var/www/examplesite/current -> /var/www/examplesite/releases/20140609232305
Problem
The advanced-cache.php file created by Hyper Cache when activated, adds this line:
$hyper_cache_path = '/var/www/examplesite/releases/20140609191622/wp-content/cache/hyper-cache/';
When the site is redeployed, this path should no longer be used, but to change it, I would need to manually deactivate and reactivate the plugin (or edit advanced-cache.php directly).
Ideally, I would like it to be this:
$hyper_cache_path = '/var/www/examplesite/current/wp-content/cache/hyper-cache/';
Would it be possible to set a constant in wp-config.php, eg HYPERCACHE_CACHE_PATH, and if this constant exists, use it in the hyper_generate_config
function:
if (defined('HYPERCACHE_CACHE_PATH')) {
$buffer .= '$hyper_cache_path = \'' . HYPERCACHE_CACHE_PATH . \'' . ";\n";
} else {
// the normal defintion
}
I can certainly do this, but I don’t want to lose changes when the plugin gets updated.
Please let me know – this would make deploying Hyper Cache incredibly easy (something that isn’t true for any of the other caching plugins out there)