You are here

function expire_rules_action_flush_url in Cache Expiration 7.2

Same name and namespace in other branches
  1. 6 expire.rules.inc \expire_rules_action_flush_url()
  2. 7 expire.rules.inc \expire_rules_action_flush_url()

Expires pages from cache_page bin.

Parameters

$urls: Array with user-defined URLs and internal paths.

File

./expire.rules.inc, line 36
Integration with the Rules module.

Code

function expire_rules_action_flush_url($urls) {
  global $base_url;
  $absolute_urls = array();
  $internal_paths = array();
  $urls = explode("\r\n", $urls);
  foreach ($urls as &$url) {
    if (strpos($url, $base_url) === 0) {
      $absolute_urls[] = trim($url);
    }
    else {
      $internal_paths[] = trim($url);
    }
  }
  if (!empty($internal_paths)) {
    ExpireAPI::executeExpiration($internal_paths);
  }
  if (!empty($absolute_urls)) {
    ExpireAPI::executeExpiration($absolute_urls, '', NULL, TRUE);
  }
}