function _akamai_get_all_paths in Akamai 8.2
Same name and namespace in other branches
- 8 akamai.module \_akamai_get_all_paths()
- 6.2 akamai.module \_akamai_get_all_paths()
- 6 akamai.module \_akamai_get_all_paths()
- 7 akamai.module \_akamai_get_all_paths()
- 7.2 akamai.module \_akamai_get_all_paths()
Return all system and alias paths for the provided URL.
@todo: seems like there should be a more abstracted means of getting the aliases; research and verify
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 147 - 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::service('path.alias_manager')
->getPathByAlias($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 langcode IN (:language, :language_none)', array(
':source' => $source,
':language' => isset($language->language) ? $language->language : '',
':language_none' => Language::LANGCODE_NOT_SPECIFIED,
));
foreach ($result as $record) {
$paths[] = $record->alias;
}
// If this is the frontpage, add a blank to clear the root doc
if ($source == \Drupal::config('system.site')
->get('page.front')) {
$paths[] = '';
}
// Allow other modules to add/modify paths to be cleared
drupal_alter('akamai_paths', $paths, $node);
return $paths;
}