]> git.nbdom.net Git - nb.git/commitdiff
db includes
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 14 Sep 2016 11:00:57 +0000 (13:00 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 14 Sep 2016 11:00:57 +0000 (13:00 +0200)
lib/php/db/config.php
lib/php/db/index.php
lib/php/db/init.php
lib/php/db/page.php
lib/php/db/shell.php

index da838cc9538a2228f6b97e6f639ca5d0aa0f36a3..f2e0817bf6d0b1e459c827baf9dab1693e73d37f 100644 (file)
@@ -4,6 +4,5 @@ require_once(realpath(dirname(__FILE__).'/../db.php'));
 
 Db::pinit();
 
-if(defined('DB_NO_INIT') and DB_NO_INIT) return true;
-Db::init([Db::ROOT_DIR.'/etc/dbs.yaml',Db::ROOT_DIR.'/etc/dbs.php','/etc/dbs.yaml']);
+$DB_CONFS = Db::conf_load([ Db::ROOT_DIR.'/etc/dbs.yaml',Db::ROOT_DIR.'/etc/dbs.php','/etc/dbs.yaml' ]);
 ?>
index 0664afc12d5c30540c731c92bf8f0edaee8f7021..11d6df05ef3ce54e276f7185b2a8e3955aada55d 100755 (executable)
@@ -6,7 +6,7 @@
 *
 * lib/php/db/index.php
 */
-require_once(realpath(dirname(__FILE__).'/config.php'));
+require_once(realpath(dirname(__FILE__).'/init.php'));
 
 if(defined('DB_NO_ACTION') and DB_NO_ACTION) return true;
 
index 4caa39e2763e2fa7aef5e6c415c56d7dbd4a5307..990aba06bec6a0a72346280fa6aa44405a04bf95 100644 (file)
@@ -2,7 +2,6 @@
 require_once(realpath(dirname(__FILE__).'/../config.php'));
 require_once(realpath(dirname(__FILE__).'/../db.php'));
 
-define('DB_NO_INIT',true);
 require_once(realpath(dirname(__FILE__).'/config.php'));
 
 Db::init($DB_CONFS);
index 476370b55d1104f8f4f759ea0f49f03c8a533d77..b4a87bc68977da07bd6a487ec71c14edd4b0de3f 100644 (file)
@@ -1,8 +1,6 @@
 <?php
-require_once(dirname(__FILE__).'/../config.php');
+require_once(dirname(__FILE__).'/init.php');
 require_once(dirname(__FILE__).'/../page.php');
-
-require_once(dirname(__FILE__).'/../db/config.php');
 $Page = new Page([
   'title' => ($Db->title ? $Db->title : Db::prettyText($Db->name)),
   'content_type' => Page::content_type_and_set_format(),
index fd07f729923c95c1f802a7139171124a4188341c..bf99f8403b6f9f6aaf22f040610edb8f08f172c2 100755 (executable)
@@ -1,7 +1,6 @@
 #!/usr/bin/env php
 <?php
-require_once(dirname(__FILE__).'/../config.php');
-require_once(dirname(__FILE__).'/../db.php');
+require_once(dirname(__FILE__).'/config.php');
 
 #
 # Default params
@@ -11,11 +10,6 @@ require_once(dirname(__FILE__).'/../db.php');
 #bye(out::client_type());
 Db::pdef('format','human');
 
-#
-# Confs
-#
-$Confs = Db::conf_load([ Db::ROOT_DIR.'/etc/dbs.yaml',Db::ROOT_DIR.'/etc/dbs.php','/etc/dbs.yaml' ]);
-
 #
 # Parse stdin
 #
@@ -27,7 +21,7 @@ $no_reset_params = [
   'table',
   'format',
 ];
-#bye($Confs['ui']);
+#bye($DB_CONFS['ui']);
 
 while($line = fgets(STDIN)){
   $line = trim($line);
@@ -52,7 +46,7 @@ while($line = fgets(STDIN)){
 }
 
 function db_shell_action($k,$v) {
-  global $Confs, $Db, $Table;
+  global $DB_CONFS, $Db, $Table;
   Db::pset($k,$v);
   Db::pinit();
 
@@ -73,8 +67,8 @@ function db_shell_action($k,$v) {
       break;
 
     case 'db':
-#bye($Confs[$v]);
-      $Db = new Db($Confs[$v]+['conf'=>$Confs]);
+#bye($DB_CONFS[$v]);
+      $Db = new Db($DB_CONFS[$v]+['conf'=>$DB_CONFS]);
       $Db->connect();
       break;