From: Nicolas Boisselier Date: Sat, 12 Nov 2016 21:21:31 +0000 (+0000) Subject: profile.d, /etc/dbq/ X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=243303099c79d52522b065e10add4960901d67c1;p=nb.git profile.d, /etc/dbq/ --- diff --git a/etc/profile.d/docker.sh b/etc/profile.d/docker.sh index afab6f55..05fe1c2f 100644 --- a/etc/profile.d/docker.sh +++ b/etc/profile.d/docker.sh @@ -15,8 +15,9 @@ _docker_name() { } docker_build() { - local docker_name=$(_docker_name "$1") || return; shift - [ -e Dockerfile ] || exec echo "Dockerfile missing in $(pwd)" 1>&2 + + local docker_name=$(_docker_name "$1") || return ; shift + [ ! -e Dockerfile ] && echo "Dockerfile missing in $(pwd)" 1>&2 && return if [ -n "$(docker images -q $docker_name 2>/dev/null)" ]; then echo "$docker_name already build." @@ -38,9 +39,9 @@ docker_build() { docker_run() { local docker_name=$(_docker_name "$1") || return - [ -n "$1" -a -d "$1" ] && cd "$1" + #[ -n "$1" -a -d "$1" ] && cd "$1" shift - perl -ne '/^\s*\#\s*DOCKER_RUN\s*(.*?)$/ and $RUN=1 and system "$1"; END{exit ($RUN ? 0 : 1)}' Dockerfile && return + [ -e Dockerfile ] && perl -ne '/^\s*\#\s*DOCKER_RUN\s*(.*?)$/ and $RUN=1 and system "$1"; END{exit ($RUN ? 0 : 1)}' Dockerfile && return docker run --rm -it --name $docker_name --hostname $docker_name $@ $docker_name } diff --git a/lib/php/db/config.php b/lib/php/db/config.php index 6b482fc9..fe94fa82 100644 --- a/lib/php/db/config.php +++ b/lib/php/db/config.php @@ -2,13 +2,17 @@ require_once(realpath(dirname(__FILE__).'/../config.php')); require_once(realpath(dirname(__FILE__).'/../db.php')); -$DB_CONFS = Db::conf_load([ +$DB_CONFS = Db::conf_load( +glob('/etc/dbq/*.yaml')+ +glob('/etc/dbq/*.php')+ +[ Db::ROOT_DIR.'/etc/dbs.yaml', Db::ROOT_DIR.'/etc/dbs.php', Db::ROOT_DIR.'/etc/dbq.yaml', Db::ROOT_DIR.'/etc/dbq.php', + '/etc/dbs.yaml', '/etc/dbq.yaml', diff --git a/lib/php/nb.php b/lib/php/nb.php index 683bd821..0e284e61 100644 --- a/lib/php/nb.php +++ b/lib/php/nb.php @@ -715,15 +715,15 @@ class NB { public static function ls_dir($path,$exp='',$recurse=false) { - $ls = array(); + $ls = []; $rep = opendir($path); - #die(">>>".$exp); while($file = readdir($rep)) { - if ($file == '.' or $file == '..') continue; + if ($file === '' or $file == '.' or $file == '..') continue; +#die(">>>$file | $exp | $path"); - if (!$exp or preg_match('#'.$exp.'#',$file)) { + if (empty($exp) or preg_match('#'.$exp.'#',$file)) { $ls[] = $file; #$ls[] = "$path/$file"; }