function akamai_clear_url in Akamai 7
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.2 akamai.module \akamai_clear_url()
Clear a URL from Akamai. Clears node/id and any url aliases.
Parameters
$paths_in: a array of paths or single path to clear
$params: an array of params for the API call
Return value
TRUE if it was successfully cleared, FALSE otherwise.
10 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 187 
- akamai.module Integration with the Akamai CDN Cache Control Web Service.
Code
function akamai_clear_url($paths_in, $params = array(), $node = NULL) {
  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);
  // Setup the notification email if an email address is not provided
  if (!array_key_exists('email', $params) || empty($params['email'])) {
    $params['email'] = akamai_get_notification_email();
  }
  try {
    $akamai = akamai_get_class($params);
    $response = $akamai
      ->clear_url($paths);
    $response['client'] = $akamai;
    return $response;
  } catch (Exception $e) {
    return FALSE;
  }
}