function akamai_clear_url in Akamai 7.2
Same name and namespace in other branches
- 8 akamai.module \akamai_clear_url()
- 8.2 akamai.module \akamai_clear_url()
- 6.2 akamai.module \akamai_clear_url()
- 6 akamai.module \akamai_clear_url()
- 7.3 akamai.module \akamai_clear_url()
- 7 akamai.module \akamai_clear_url()
Clear a URL from Akamai. Clears node/id and any URL aliases.
Parameters
array $paths_in: An array of paths or single path to clear.
array $params: (optional) An array of params for the API call.
object $node: (optional)
Return value
bool TRUE if it was successfully cleared, FALSE otherwise.
12 calls to akamai_clear_url()
- AkamaiHomepageTestCase::testHomepageClear in ./
akamai.test - Tests clear of homepage and rendering of block
- AkamaiHookTestCase::testEmptyClear in ./
akamai.test - Tests clear with no paths.
- AkamaiHookTestCase::testHookClear in ./
akamai.test - Tests clear with hook provided paths.
- AkamaiTestCase::testAliasClear in ./
akamai.test - Tests clear with 1 alias.
- AkamaiTestCase::testMultipleAliasClear in ./
akamai.test - Tests clear with multiple aliases.
File
- ./
akamai.module, line 218 - Integration with the Akamai CDN Cache Control Web Service.
Code
function akamai_clear_url($paths_in, $params = array(), $node = NULL) {
if (variable_get('akamai_disabled', FALSE)) {
watchdog('akamai', 'Request to clear paths ignored because clearing is disabled. Check module settings.');
return FALSE;
}
if (!is_array($paths_in)) {
$paths_in = array(
$paths_in,
);
}
// Get the system path and all aliases to this url
$paths = array();
foreach ($paths_in as $path) {
$paths = array_merge($paths, _akamai_get_all_paths($path, $node));
}
// It is possible to have no paths at this point if other modules have
// altered the paths.
if (empty($paths)) {
watchdog('akamai', 'No resultant paths to clear for %paths', array(
'%paths' => implode(', ', $paths_in),
), WATCHDOG_NOTICE);
return FALSE;
}
$paths = array_unique($paths);
try {
$akamai = akamai_get_class($params);
$response = $akamai
->clear_url($paths);
if (is_object($response)) {
$response->client = $akamai;
}
return $response;
} catch (AkamaiException $e) {
watchdog_exception('akamai', $e);
return FALSE;
}
}