43,7 → 43,8 |
|
function cel_get_obs() { |
$URL = DOMAIN . '/jrest/InventoryObservationList/' . USER; |
return json_decode(file_get_contents($URL . '/?limite=100000&numero_page=0')); |
// 5000 (memory_limit) |
return json_decode(file_get_contents($URL . '/?limite=5000&numero_page=0')); |
} |
|
function cel_get_images() { |
59,6 → 60,8 |
curl_setopt($ch,CURLOPT_URL, $URL . '/' . implode(',', $obs)); |
curl_setopt($ch,CURLOPT_POSTFIELDS, array('action' => 'DELETE')); |
curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE); |
|
if(DEBUG) @fwrite(STDERR, sprintf("curl -F action=DELETE '%s/%s'\n", $URL, implode(',', $obs))); |
//execute post |
$result = curl_exec($ch); |
curl_close($ch); |
81,9 → 84,13 |
|
|
function cel_delete_all_obs() { |
$obs = cel_get_obs(); |
while( ($obs = cel_get_obs()) ) { |
$ordres = array_map(function($item) { return $item->ordre; }, $obs); |
cel_delete_obs($ordres); |
// les chunks permettent d'éviter des REQUEST-URI too long (500 id * 4 digits + 500 (virgules)) < 4k |
while( $ordres_chunk = array_splice($ordres, 0, 500)) { |
cel_delete_obs($ordres_chunk); |
} |
} |
} |
|
|