From e5b6a9d5bb23b1864d072af972268912b8c19f5e Mon Sep 17 00:00:00 2001 From: Olov Danielson Date: Thu, 14 Jan 2010 12:15:26 +0000 Subject: [PATCH] refactoring. removed unneccessary SQL query --- tests/syncLibTest.php | 2 +- ykval-synclib.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/syncLibTest.php b/tests/syncLibTest.php index 6bf24ad..1750b4c 100644 --- a/tests/syncLibTest.php +++ b/tests/syncLibTest.php @@ -28,7 +28,7 @@ class SyncLibTest extends PHPUnit_Framework_TestCase { $sl = new SyncLib(); $this->assertGreaterThan(1, $sl->getNumberOfServers()); - $this->assertEquals($sl->getServer(0), "http://1.2.3.4/wsapi/2.0/sync"); + $this->assertEquals($sl->getServer(0), "http://api2.example.com/wsapi/2.0/sync"); } diff --git a/ykval-synclib.php b/ykval-synclib.php index d80c751..e77c71e 100644 --- a/ykval-synclib.php +++ b/ykval-synclib.php @@ -187,9 +187,8 @@ class SyncLib public function updateDbCounters($params) { - $res=$this->db->findBy('yubikeys', 'yk_publicname', $params['yk_publicname'], 1); - $this->log(LOG_INFO, 'yk_publicname is ' . $res['yk_publicname']); - if (isset($res['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))' ; if(! $this->db->conditionalUpdateBy('yubikeys', 'yk_publicname', $params['yk_publicname'],