The akamai_cache_control_submit (in akamai.admin.inc) function contains a lot of response checking and reporting which is not in place for other invocations of akamai_clear_url. This should be abstracted out so that individual invocations do not need to also check response.

180   if ($result = akamai_clear_url($paths, $overrides)) {
181     $message = t("Akamai Cache Request has been made successfully.") . theme("item_list", $paths);
182     $status = 'status';
183
184     if (is_object($result) && !empty($result->data)) {
185       if ($akamai_response_data = json_decode($result->data)) {
186         if (isset($akamai_response_data->httpStatus) && $akamai_response_data->httpStatus > 300) {
187           $message = t("There was a problem with your cache clearing request.  The error message returned was '@msg'",
188             array('@msg' => $akamai_response_data->details));
189           $status = 'error';
190         }
191         else {
192           $message = t("Akamai Cache Request has been made successfully.  Akamai reports an estimated time to completion of @time",
193             array('@time' => format_interval($akamai_response_data->estimatedSeconds))) . theme("item_list", $paths);
194         }
195       }
196       else {
197         $message = t('There was a problem with your cache clearing request. Please check the watchdog logs for details.');
198         $status = 'error';
199
200         watchdog('akamai', 'Unable to parse Akamai API response data: @json_data',
201           array('@json_data' => '<pre>' . print_r($result->data, TRUE) . '</pre>'), WATCHDOG_ERROR);
202       }
203     }
204   }
205   else {
206     $message = t('There was a problem with your cache clearing request. Please check the watchdog logs for details.');
207     $status = 'error';
208   }
CommentFileSizeAuthor
#2 2395211-response_handling-2.patch5.07 KBbarrett

Comments

barrett’s picture

Assigned: Unassigned » barrett
barrett’s picture

StatusFileSize
new5.07 KB

Here's an initial (largely untested) patch to elaborate thinking.

barrett’s picture

Status: Active » Needs review
WidgetsBurritos’s picture

Status: Needs review » Postponed
smustgrave’s picture

Status: Postponed » Closed (outdated)

With D7 EOL lets close D7 tickets. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.