You are here

function _akamai_get_all_paths in Akamai 7

Same name and namespace in other branches
  1. 8 akamai.module \_akamai_get_all_paths()
  2. 8.2 akamai.module \_akamai_get_all_paths()
  3. 6.2 akamai.module \_akamai_get_all_paths()
  4. 6 akamai.module \_akamai_get_all_paths()
  5. 7.2 akamai.module \_akamai_get_all_paths()

Return all system and alias paths for the provided URL.

Parameters

$url: The URL to find all aliases

$node: The Node for the URL being cleared if one exists, NULL otherwise

Return value

An array of all paths aliased to the provided URL.

1 call to _akamai_get_all_paths()
akamai_clear_url in ./akamai.module
Clear a URL from Akamai. Clears node/id and any url aliases.

File

./akamai.module, line 233
akamai.module Integration with the Akamai CDN Cache Control Web Service.

Code

function _akamai_get_all_paths($url, $node = NULL) {
  global $language;

  // If it is not a node path, get the system path
  if (strpos($url, 'node') !== 0) {
    $source = drupal_lookup_path('source', $url);
  }
  if (!isset($source) || !$source) {
    $source = $url;
  }
  $source = preg_replace("/^\\//", "", $source);
  $paths[] = $source;
  $result = db_query('SELECT alias FROM {url_alias} WHERE source = :source AND language IN (:language, :language_none)', array(
    ':source' => $source,
    ':language' => isset($language->language) ? $language->language : '',
    ':language_none' => LANGUAGE_NONE,
  ));
  foreach ($result as $record) {
    $paths[] = $record->alias;
  }

  // If this is the frontpage, add a blank to clear the root doc
  if ($source == variable_get('site_frontpage', 'node')) {
    $paths[] = '';
  }

  // Allow other modules to add/modify paths to be cleared
  drupal_alter('akamai_paths', $paths, $node);
  return $paths;
}