]> git.nbdom.net Git - nb.git/commitdiff
lib/php/db/config.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 8 Jan 2018 16:54:39 +0000 (16:54 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 8 Jan 2018 16:54:39 +0000 (16:54 +0000)
lib/php/db/config.php
www/dbq/dbq.php

index df5dd19599de1467db173e557360d7e44f0c819d..a1cc6087f8dd18a79fca46a1653cb23f730ce326 100644 (file)
@@ -1,8 +1,24 @@
 <?php
 require_once(realpath(dirname(__FILE__).'/../config.php'));
 require_once(NB_ROOT.'/lib/php/db.php');
+if (empty($DB_CONFS)) $DB_CONFS = [];
+
+if (!empty($_SERVER['DBQ_CONF_FILE'])) {
+       $DB_CONFS = array_merge($DB_CONFS,explode(' ',$_SERVER['DBQ_CONF_FILE']));
+}
+
+if (!empty($_SERVER['DBQ_CONF_DIR'])) {
+       foreach (explode(' ',$_SERVER['DBQ_CONF_DIR']) as $dir) {
+               $DB_CONFS = array_merge($DB_CONFS,
+                       (array)glob($dir.'/*.yml'),
+                       (array)glob($dir.'/*.yaml'),
+                       (array)glob($dir.'/*.php'),
+               []);
+       }
+}
+
 if (empty($_SERVER['HOME'])) $_SERVER['HOME'] = '';
-$DB_CONFS = array_merge([],
+if (empty($DB_CONFS)) $DB_CONFS = array_merge([],
 
   # ::ROOT_DIR
 # NB 04.01.18   [
index 7616cff04da2457af9bf2216dc52e6e8039cd5ac..01b5fedb78fabf0ce9944e5f5ae7f0363576d1f6 100644 (file)
@@ -344,6 +344,7 @@ class DbQ extends nb {
                require_once(NB_ROOT.'/lib/php/db.php');
 
                // New
+               /*
                global $DB_CONFS;
                if(empty($DB_CONFS)) $DB_CONFS = [];
 
@@ -359,14 +360,8 @@ class DbQ extends nb {
                                        (array)glob($dir.'/*.php'),
                                []);
                        }
-/*
-                       $DB_CONFS = array_merge($DB_CONFS,
-                               (array)glob($_SERVER['DBQ_CONF_DIR'].'/*.yml'),
-                               (array)glob($_SERVER['DBQ_CONF_DIR'].'/*.yaml'),
-                               (array)glob($_SERVER['DBQ_CONF_DIR'].'/*.php'),
-                       []);
-*/
                }
+        */
 
                if (empty($DB_CONFS)) {
                        require_once(NB_ROOT.'/lib/php/db/config.php');