From c0dc531ebefd8912819f3b6c8bda1fed3c7e750c Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Wed, 31 Jan 2024 06:11:00 +0300 Subject: make it simple, but not simpler --- lib/config.php | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 lib/config.php (limited to 'lib/config.php') diff --git a/lib/config.php b/lib/config.php deleted file mode 100644 index bb7e5ca..0000000 --- a/lib/config.php +++ /dev/null @@ -1,46 +0,0 @@ -query("SELECT value FROM config WHERE name=?", $key); - if (!$db->numRows($q)) - return null; - return $db->result($q); - } - - public static function mget($keys) { - $map = []; - foreach ($keys as $key) { - $map[$key] = null; - } - - $db = getDb(); - $keys = array_map(fn($s) => $db->escape($s), $keys); - - $q = $db->query("SELECT * FROM config WHERE name IN('".implode("','", $keys)."')"); - while ($row = $db->fetch($q)) - $map[$row['name']] = $row['value']; - - return $map; - } - - public static function set($key, $value) { - $db = getDb(); - return $db->query("REPLACE INTO config (name, value) VALUES (?, ?)", $key, $value); - } - - public static function mset($map) { - $rows = []; - foreach ($map as $name => $value) { - $rows[] = [ - 'name' => $name, - 'value' => $value - ]; - } - $db = getDb(); - return $db->multipleReplace('config', $rows); - } - -} -- cgit v1.2.3