mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-02-17 21:54:18 +01:00
Refactor updateDbCounters.
- make it easier to follow what is happening.
This commit is contained in:
parent
3b4735d34d
commit
d5a56f6b8c
@ -263,24 +263,33 @@ class SyncLib
|
|||||||
{
|
{
|
||||||
if (isset($params['yk_publicname'])) {
|
if (isset($params['yk_publicname'])) {
|
||||||
$condition='('.$params['yk_counter'].'>yk_counter or ('.$params['yk_counter'].'=yk_counter and ' . $params['yk_use'] . '>yk_use))' ;
|
$condition='('.$params['yk_counter'].'>yk_counter or ('.$params['yk_counter'].'=yk_counter and ' . $params['yk_use'] . '>yk_use))' ;
|
||||||
if(! $this->db->conditionalUpdateBy('yubikeys', 'yk_publicname', $params['yk_publicname'],
|
|
||||||
array('modified'=>$params['modified'],
|
$arr = array(
|
||||||
'yk_counter'=>$params['yk_counter'],
|
'modified' => $params['modified'],
|
||||||
'yk_use'=>$params['yk_use'],
|
'yk_counter' => $params['yk_counter'],
|
||||||
'yk_low'=>$params['yk_low'],
|
'yk_use' => $params['yk_use'],
|
||||||
'yk_high'=>$params['yk_high'],
|
'yk_low' => $params['yk_low'],
|
||||||
'nonce'=>$params['nonce']),
|
'yk_high' => $params['yk_high'],
|
||||||
$condition))
|
'nonce' => $params['nonce']
|
||||||
{
|
);
|
||||||
$this->log(LOG_CRIT, 'failed to update internal DB with new counters');
|
|
||||||
return false;
|
if (! $this->db->conditionalUpdateBy('yubikeys', 'yk_publicname', $params['yk_publicname'], $arr, $condition))
|
||||||
} else
|
{
|
||||||
{
|
$this->log(LOG_CRIT, 'failed to update internal DB with new counters');
|
||||||
if ($this->db->rowCount()>0) $this->log(LOG_INFO, "updated database ", $params);
|
return false;
|
||||||
else $this->log(LOG_INFO, 'database not updated', $params);
|
}
|
||||||
return true;
|
else
|
||||||
}
|
{
|
||||||
} else return false;
|
if ($this->db->rowCount()>0)
|
||||||
|
$this->log(LOG_INFO, "updated database ", $params);
|
||||||
|
else
|
||||||
|
$this->log(LOG_INFO, 'database not updated', $params);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function countersHigherThan($p1, $p2)
|
public function countersHigherThan($p1, $p2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user