Check if our version of roll data is valid and if necessary, initialize

the database.

This fix the case where the database is not initialized because the used
field in backup file is empty.

Fix the issue #5113.
This commit is contained in:
Luiz Otavio O Souza 2015-09-15 11:55:35 -05:00
parent 32cf6a0c1c
commit ce274e4545

View File

@ -557,6 +557,9 @@ function voucher_configure_zone($sync = false) {
foreach ($config['voucher'][$cpzone]['roll'] as $rollent) {
$roll = $rollent['number'];
$len = ($rollent['count'] >> 3) + 1;
if (strlen(base64_decode($rollent['used'])) != $len)
$rollent['used'] = base64_encode(str_repeat("\000", $len));
voucher_write_used_db($roll, $rollent['used']);
$minutes = $rollent['minutes'];
$active_vouchers = array();