You are here

function cache_actions_action_clear_varnish_page in Cache Actions 6.2

Same name and namespace in other branches
  1. 7 cache_actions.rules.inc \cache_actions_action_clear_varnish_page()

File

./cache_actions.rules.inc, line 587
This file provides the rules integration for this module.

Code

function cache_actions_action_clear_varnish_page($paths) {
  if (module_exists('varnish')) {
    $paths = preg_split("/(\r\n?|\n)/", $paths);

    // Since varnish don't understand things like <front>, we need to
    // Replace that with something it does understand. If <front> exists more than
    // once, we ignore it, since the cache will be cleared anyway.
    if (($key = array_search('<front>', $paths)) !== FALSE) {
      $paths[$key] = '';
    }
    varnish_expire_cache($paths);
  }
}