From 9aa740d29982d7e8b842670b6f7a7e7bb258ecbc Mon Sep 17 00:00:00 2001 From: Jean Paul Galea Date: Tue, 8 Sep 2015 09:21:25 +0200 Subject: [PATCH] Refactor. - string substitution rather than concatenation. --- ykval-munin-yubikeystats.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ykval-munin-yubikeystats.php b/ykval-munin-yubikeystats.php index e3c4407..97fe3be 100755 --- a/ykval-munin-yubikeystats.php +++ b/ykval-munin-yubikeystats.php @@ -69,7 +69,7 @@ if (!$db->connect()) function get_count($db, $table, $conditions) { - $res = $db->customQuery('SELECT count(1) as count FROM ' . $table . ' WHERE ' . $conditions); + $res = $db->customQuery("SELECT count(1) as count FROM $table WHERE $conditions"); if ($res) { @@ -81,16 +81,16 @@ function get_count($db, $table, $conditions) } if ($count = get_count($db, 'yubikeys', 'active=true')) - echo "yubikeys_enabled.value " . $count . "\n"; + echo "yubikeys_enabled.value $count\n"; if ($count = get_count($db, 'yubikeys', 'active=false')) - echo "yubikeys_disabled.value " . $count . "\n"; + echo "yubikeys_disabled.value $count\n"; if ($count = get_count($db, 'yubikeys', 'modified >= ' . (time() - (31 * 86400)))) - echo "yubikeys_1month.value " . $count . "\n"; + echo "yubikeys_1month.value $count\n"; if ($count = get_count($db, 'clients', 'active=true')) - echo "clients_enabled.value " . $count . "\n"; + echo "clients_enabled.value $count\n"; if ($count = get_count($db, 'clients', 'active=false')) - echo "clients_disabled.value " . $count . "\n"; + echo "clients_disabled.value $count\n";