minfix: store api.response even if response error

This commit is contained in:
xdrm-brackets 2017-09-26 16:30:25 +02:00
parent 9b580638ba
commit 37bb4368a7
2 changed files with 10 additions and 11 deletions

View File

@ -113,10 +113,13 @@
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
/* (2) Close request */
/* (2) Save response to file */
file_put_contents(TMP_DIR.'/api.response', $response);
/* (3) Close request */
curl_close($curl);
/* (3) Return response as result */
/* (4) Return response as result */
if( $response === false ){
slog("Request error", 'api:sync','update');
return 127;
@ -141,10 +144,6 @@
}
/* (3) Writes request to temporary pipe */
file_put_contents(TMP_DIR.'/api.response', $response);
/* [7] Decrement cyclic-hash so request has ran successfully
=========================================================*/
/* (1) Decrement the hash */

View File

@ -97,10 +97,13 @@
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
/* (2) Close request */
/* (2) Save response to file */
file_put_contents(TMP_DIR.'/api.response', $response);
/* (3) Close request */
curl_close($curl);
/* (3) Return response as result */
/* (4) Return response as result */
if( $response === false ){
slog("Request error", 'api:update','update');
return 127;
@ -123,9 +126,6 @@
return 127;
}
/* (3) Writes request to temporary pipe */
file_put_contents(TMP_DIR.'/api.response', $response);
/* [7] Decrement cyclic-hash so request has ran successfully
=========================================================*/