You are here

function akamai_log_purge_request in Akamai 7.3

Logs the purge request for reporting and progress tracking.

1 call to akamai_log_purge_request()
akamai_submit_purge_request in ./akamai.module
Submits a purge request to the CCU API.

File

./akamai.module, line 455
Integration with Akamai CDN CCU API.

Code

function akamai_log_purge_request($hostname, $paths, $response) {
  try {
    $time = time();
    $is_fast_purge = empty($response->progressUri);
    $record = [
      'purge_id' => $response->purgeId,
      'support_id' => $response->supportId,
      'estimated_seconds' => $response->estimatedSeconds,
      'check_after' => $is_fast_purge ? NULL : $time + $response->pingAfterSeconds,
      'submission_time' => $time,
      'status' => $response->detail,
      'progress_uri' => $is_fast_purge ? NULL : $response->progressUri,
      'completion_time' => $is_fast_purge ? $time + $response->estimatedSeconds : NULL,
      'hostname' => $hostname,
      'paths' => array_unique($paths),
    ];
    return drupal_write_record('akamai_purge_requests', $record);
  } catch (Exception $e) {
    watchdog_exception('akamai', $e);
    return FALSE;
  }
}