From 0db9c82f0a7bdf13a57304fef6105e272167f586 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 14 Sep 2016 13:00:57 +0200 Subject: [PATCH] db includes --- lib/php/db/config.php | 3 +-- lib/php/db/index.php | 2 +- lib/php/db/init.php | 1 - lib/php/db/page.php | 4 +--- lib/php/db/shell.php | 16 +++++----------- 5 files changed, 8 insertions(+), 18 deletions(-) diff --git a/lib/php/db/config.php b/lib/php/db/config.php index da838cc9..f2e0817b 100644 --- a/lib/php/db/config.php +++ b/lib/php/db/config.php @@ -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' ]); ?> diff --git a/lib/php/db/index.php b/lib/php/db/index.php index 0664afc1..11d6df05 100755 --- a/lib/php/db/index.php +++ b/lib/php/db/index.php @@ -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; diff --git a/lib/php/db/init.php b/lib/php/db/init.php index 4caa39e2..990aba06 100644 --- a/lib/php/db/init.php +++ b/lib/php/db/init.php @@ -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); diff --git a/lib/php/db/page.php b/lib/php/db/page.php index 476370b5..b4a87bc6 100644 --- a/lib/php/db/page.php +++ b/lib/php/db/page.php @@ -1,8 +1,6 @@ ($Db->title ? $Db->title : Db::prettyText($Db->name)), 'content_type' => Page::content_type_and_set_format(), diff --git a/lib/php/db/shell.php b/lib/php/db/shell.php index fd07f729..bf99f840 100755 --- a/lib/php/db/shell.php +++ b/lib/php/db/shell.php @@ -1,7 +1,6 @@ #!/usr/bin/env php $Confs]); +#bye($DB_CONFS[$v]); + $Db = new Db($DB_CONFS[$v]+['conf'=>$DB_CONFS]); $Db->connect(); break; -- 2.47.3