From fcdb19380a0531ab4a7d837c531bbb4176ac9549 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Tue, 12 Jun 2018 03:46:45 +0100 Subject: [PATCH] bin/nb-run-parts --- bin/nb-run-parts | 26 ++++++++++++++++++++++++++ lib/php/db.php | 2 ++ lib/php/db/table.php | 9 +++++++-- www/dbq/dbq.php | 2 +- 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100755 bin/nb-run-parts diff --git a/bin/nb-run-parts b/bin/nb-run-parts new file mode 100755 index 00000000..95e9d29b --- /dev/null +++ b/bin/nb-run-parts @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +##################################################################### +# +# bin/nb-run-parts +# +##################################################################### + +USAGE="nb-run-parts PATH" +DIR=${1:?$USAGE} +LOG_DIR="/var/log/nb" +LOCK_DIR="/var/run/nb" +#run-parts --report $NB_ROOT/etc/cron.daily + +for script in $DIR/*; do + + [ -r "$script" -a -x "$script" ] || continue + name=$(basename "$script") + name=${name%%.*} + lock="$LOCK_DIR/$name.lock" + [ -e "$lock" ] && continue + + log="$LOG_DIR/$name.log" + + echo $name $script + +done diff --git a/lib/php/db.php b/lib/php/db.php index 48ae1df2..60295d78 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -125,6 +125,8 @@ class Db extends nb { public $formats = [ 'table','div','csv','xml','json','yaml','sh','sql','php' ]; public $limits = ['20','50','100','500','1000']; public $limit; # Here not in Table becouse of Db::out() + public $base; + public $html_base; # Classes public $out; diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 4f5e6911..aaa0affb 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -669,7 +669,8 @@ Class Table extends nb { $flat = []; foreach ($params as $k=>$v) { $flat[] = $k.'='.urlencode($v); } - return $flat ? '?'. join('&',$flat) : ''; + #debug( $this->db()->base.'?'. join('&',$flat) ); + return $flat ? $this->request_uri().'?'. join('&',$flat) : ''; } @@ -2138,7 +2139,8 @@ Class Table extends nb { if (!empty($opt['buttons'])) $buttons = $opt['buttons']; #$r = '