1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-02-20 12:54:23 +01:00

Cosmetic changes.

This commit is contained in:
Jean Paul Galea 2015-07-17 23:25:52 +02:00
parent afc81e484a
commit 9869bfe84d

View File

@ -254,38 +254,39 @@ class SyncLib
return $resParams; return $resParams;
} }
public function updateDbCounters($params) public function updateDbCounters($params)
{ {
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))';
$arr = array( $arr = array(
'modified' => $params['modified'], 'modified' => $params['modified'],
'yk_counter' => $params['yk_counter'], 'yk_counter' => $params['yk_counter'],
'yk_use' => $params['yk_use'], 'yk_use' => $params['yk_use'],
'yk_low' => $params['yk_low'], 'yk_low' => $params['yk_low'],
'yk_high' => $params['yk_high'], 'yk_high' => $params['yk_high'],
'nonce' => $params['nonce'] 'nonce' => $params['nonce']
); );
if (! $this->db->conditionalUpdateBy('yubikeys', 'yk_publicname', $params['yk_publicname'], $arr, $condition)) if (! $this->db->conditionalUpdateBy('yubikeys', 'yk_publicname', $params['yk_publicname'], $arr, $condition))
{ {
$this->log(LOG_CRIT, 'failed to update internal DB with new counters'); $this->log(LOG_CRIT, 'failed to update internal DB with new counters');
return false; return false;
} }
else else
{ {
if ($this->db->rowCount()>0) if ($this->db->rowCount() > 0)
$this->log(LOG_INFO, "updated database ", $params); $this->log(LOG_INFO, 'updated database ', $params);
else else
$this->log(LOG_INFO, 'database not updated', $params); $this->log(LOG_INFO, 'database not updated', $params);
return true; return true;
} }
} }
return false; return false;
} }
public function countersHigherThan($p1, $p2) public function countersHigherThan($p1, $p2)
{ {