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 }
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 2395211-response_handling-2.patch | 5.07 KB | barrett |
Comments
Comment #1
barrett commentedComment #2
barrett commentedHere's an initial (largely untested) patch to elaborate thinking.
Comment #3
barrett commentedComment #4
WidgetsBurritos commentedPostponed pending #3244672: Seeking 7.x Maintainer
Comment #5
smustgrave commentedWith D7 EOL lets close D7 tickets. Thanks!