mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-07 21:41:59 +01:00
Fixed sign.php to handle non-continuous id values
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
333dd08d36
commit
1931caec2b
@ -128,27 +128,27 @@ function get_hash_values() {
|
||||
|
||||
if($last_id == 0) {
|
||||
$start_id = TSA_START_ID;
|
||||
if(MODE == 'unit') { $stop_id = $start_id + TSA_STAMP_REQUEST_UNIT_SIZE - 1; }
|
||||
else { $stop_id = 1000000000; }
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$start_id = $last_id + 1;
|
||||
if(MODE == 'unit') { $stop_id = $start_id + TSA_STAMP_REQUEST_UNIT_SIZE - 1; }
|
||||
else { $stop_id = 1000000000; }
|
||||
}
|
||||
|
||||
$query = $db->query("SELECT id, digest FROM " . TABLE_META . " WHERE id >= ? AND id <= ? ORDER BY id", array($start_id, $stop_id));
|
||||
if(MODE == 'unit') {
|
||||
$limit = TSA_STAMP_REQUEST_UNIT_SIZE;
|
||||
} else {
|
||||
$limit = 100000; // stay well below default PHP memory_limit
|
||||
}
|
||||
|
||||
$query = $db->query("SELECT id, digest FROM " . TABLE_META . " WHERE id >= ? ORDER BY id LIMIT $limit", array($start_id));
|
||||
|
||||
foreach($query->rows as $q) {
|
||||
$count++;
|
||||
$last_id = $q['id'];
|
||||
$s .= $q['digest'];
|
||||
}
|
||||
|
||||
if(MODE == 'time') { $stop_id = $start_id + $count - 1; }
|
||||
|
||||
return [
|
||||
START_ID => $start_id,
|
||||
STOP_ID => $stop_id,
|
||||
STOP_ID => $last_id,
|
||||
COUNT => $count,
|
||||
HASH_VALUE => hash(ALGO, $s)
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user