You are here

function akamai_clear_url in Akamai 6

Same name and namespace in other branches
  1. 8 akamai.module \akamai_clear_url()
  2. 8.2 akamai.module \akamai_clear_url()
  3. 6.2 akamai.module \akamai_clear_url()
  4. 7.3 akamai.module \akamai_clear_url()
  5. 7 akamai.module \akamai_clear_url()
  6. 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 SOAP call

Return value

TRUE if it was successfully cleared, FALSE otherwise.

3 calls to akamai_clear_url()
akamai_cache_control_submit in ./akamai.admin.inc
Submit handler for akamai_cache_control().
akamai_nodeapi in ./akamai.module
Implementation of hook_nodeapi().
akamai_page_cache_control_form_submit in ./akamai.module
Submit handler for akamai_page_cache_control.

File

./akamai.module, line 174
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));
  }
  $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 = new AkamaiCacheControl($params);
    $akamai
      ->clear_url($paths);
    return TRUE;
  } catch (Exception $e) {
    return FALSE;
  }
}