From: Nicolas Boisselier Date: Tue, 13 Sep 2016 13:45:27 +0000 (+0200) Subject: clean code X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=292db3f4f71f7051312a0d7aa8d6ce2781ff475b;p=nb.git clean code --- diff --git a/etc/dbs/nb.php b/etc/dbs/nb.php index bda5549b..d5f933f6 100644 --- a/etc/dbs/nb.php +++ b/etc/dbs/nb.php @@ -10,7 +10,7 @@ $CONF['nb'] = array( ); if (strpos(php_uname("n"),'ovh.net')!==false) $CONF['nb']['order'] = 1; -$CONF['nb-sqlite'] = array ( +if (!empty($DIR_SQLITE)) $CONF['nb-sqlite'] = array ( 'host' => "$DIR_SQLITE/nb.db", 'type' => 'sqlite', '_import' => '_nb', diff --git a/lib/php/db.php b/lib/php/db.php index dc252677..b8cf5bc5 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -527,7 +527,7 @@ class Db extends nb { # Load all files into a $h if #files is not a hash $h = []; - if (is_scalar($files)) $files = array($files); + if (is_scalar($files)) $files = array($files); foreach ($files as $file) { if (!is_readable($file)) continue; @@ -590,9 +590,9 @@ class Db extends nb { * @copyright NB 12.08.16 * Return a db hash to create a new instance from $conf */ - public static function conf_search_db($conf) { + public static function conf_search_db($conf,$id=null) { - $id = self::p('db'); + if (empty($id)) $id = self::p('db'); # Load databases $conf = self::is_hash($conf) ? $conf : self::conf_load($conf); @@ -631,9 +631,6 @@ class Db extends nb { 'id' => $id, )); - # Search table - #$table = Db::p('table'); - return $db; }