Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1932 → Rev 1931

/trunk/jrest/tests/api.php
43,8 → 43,7
 
function cel_get_obs() {
$URL = DOMAIN . '/jrest/InventoryObservationList/' . USER;
// 5000 (memory_limit)
return json_decode(file_get_contents($URL . '/?limite=5000&numero_page=0'));
return json_decode(file_get_contents($URL . '/?limite=100000&numero_page=0'));
}
 
function cel_get_images() {
60,8 → 59,6
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);
84,13 → 81,9
 
 
function cel_delete_all_obs() {
while( ($obs = cel_get_obs()) ) {
$obs = cel_get_obs();
$ordres = array_map(function($item) { return $item->ordre; }, $obs);
// 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);
}
}
cel_delete_obs($ordres);
}