]> git.nbdom.net Git - nb.git/commitdiff
etc/cron/nb
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 25 May 2018 21:55:04 +0000 (22:55 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 25 May 2018 21:55:04 +0000 (22:55 +0100)
bin/nb-install
etc/cron/nb
lib/php/db/table.php
www/dbq/dbq.php

index fd1fac7ede69ab1eb8f29927dd04fbe43f259191..6c0bfd77f12066f87c22bb0ca2e79e8939e59d77 100755 (executable)
@@ -63,7 +63,7 @@ main() {
     rm -f /etc/cron.d/nb /var/log/nb.log
   else
     #shell_help_noarg "zaza" "$@" && exit 0
-    cron_d_install "$NB_ROOT/etc/cron/nb" "nb-update|$NB_ROOT|NB_LOG" && verbose "Cron: $NB_ROOT/etc/cron/nb"
+    cron_d_install "$NB_ROOT/etc/cron/nb" "nb-update|$NB_ROOT|NB_ROOT|NB_LOG" && verbose "Cron: $NB_ROOT/etc/cron/nb"
     #cron_d_install "test" "" "nico.*true" && verbose "Cron: nico"
   fi
 
index cf258160f610e100c8f2a60e87a85cf09f60de7e..d203d871aff712bd37c7c32306921f66bcd90ed2 100644 (file)
@@ -8,6 +8,10 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/nb/bin
 #####################################################################
 # m h dom mon dow user command
 #
-*/15 09-23 * * * root nb-update >/var/log/nb.log 2>&1 | true
-0       00 * * * root nb-update -cleanup >/var/log/nb.log 2>&1 | true
-0    01-08 * * * root nb-update >/var/log/nb.log 2>&1 | true
+*/15 09-23 * * * root . /etc/profile && nb-update >/var/log/nb.log 2>&1 | true
+0       00 * * * root . /etc/profile && nb-update -cleanup >/var/log/nb.log 2>&1 | true
+0    01-08 * * * root . /etc/profile && nb-update >/var/log/nb.log 2>&1 | true
+
+25 5   * * *   root    which run-parts &> /dev/null && . /etc/profile && [ -d "$NB_ROOT/etc/cron.daily" ] && cd / && run-parts --report $NB_ROOT/etc/cron.daily
+47 5   * * 7   root    which run-parts &> /dev/null && . /etc/profile && [ -d "$NB_ROOT/etc/cron.weekly" ] && cd / && run-parts --report $NB_ROOT/etc/cron.weekly
+52 5   1 * *   root    which run-parts &> /dev/null && . /etc/profile && [ -d "$NB_ROOT/etc/cron.monthly" ] && cd / && run-parts --report $NB_ROOT/etc/cron.monthly
index 0f50b8f7db473704a170c0eec4dbae4c02fff105..69dd8ef3ca2bf7166b7a90ce68c391374061a616 100644 (file)
@@ -2130,6 +2130,7 @@ Class Table extends nb {
        }
 
        public function html_menu($opt=[]) {
+               if (isset($opt['html_menu']) and !$opt['html_menu']) return '';
 
                $buttons = '<input type="submit" class="button button-small" value="Go"/>';
                if (!empty($opt['buttons'])) $buttons = $opt['buttons'];
index 0932b63639a6c8c9669ecf523792b1eb2fe38f25..8b5373fbd8dee537e6992458a096fe1f208505e4 100644 (file)
@@ -48,7 +48,7 @@ class DbQ extends nb {
        public $title = 'Dbq';
        public $sep_title = ' / ';
 
-       public $formats = [ 'html','div','csv','xml','json','yaml','sh','sql','php' ];
+       public $formats = [ 'html','div.html','csv','xml','json','yaml','sh','sql','php' ];
        public $format_cli = 'csv';
        public $format_html = 'table';
        public $format_html_ua_exp = '/^\S+\s+.Windows|iPhone|Android|Macintosh|Linux/';
@@ -306,6 +306,8 @@ class DbQ extends nb {
 #debug($this->base);
 
                        $this->page->begin();
+               } else {
+                       #$this->db->is_html = false;
                } # if (empty($this->_nopage)) {
 
                #die($obj);
@@ -713,11 +715,21 @@ class DbQ extends nb {
                $this->uri = $path;
                $this->uri_params = explode($this->expode_args,$args);
 
-               if (preg_match('/\.(\w+(\.html)?)$/',$path,$m)) {
-                       $values[] = $m[1];
+               // We accept sub extention, that will determine if we wanr to print the full page
+               if (preg_match('/\.((\w+)(\.html)?)$/',$path,$m)) {
                        $path = substr($path,0,strlen($path)-strlen($m[1])-1);
+                       $values[] = $m[2];
+
+                       if (isset($m[3])) {
+                               $this->ext = 'html';
+                       } elseif($m[2] != 'html') {
+                               $this->_nopage = true;
+                       }
+                       #bye([$path,$m[1]]);
+       
                } else {
                        $values[] = '';
+
                }
 
                $path = trim($path,'/');
@@ -919,6 +931,8 @@ EOF;
 
        public function run_init() {
                $this->db();
+               if (!empty($this->formats)) $this->db->formats = $this->formats;
+               if (!empty($this->limits)) $this->db->limits = $this->limits;
 
                // Format first !
                if ($this->params['format']) {
@@ -936,12 +950,6 @@ EOF;
 
                }
 
-               // Post defaults values
-               if (empty($this->ext)) $this->ext = $format;
-
-               if (!empty($this->formats)) $this->db->formats = $this->formats;
-               if (!empty($this->limits)) $this->db->limits = $this->limits;
-
                // Then content type
                if (empty($content_type)) $content_type = Mime::get($format==$this->format_cli ? 'txt' : $format);
                if (empty($content_type) and $this->db->out->is_html($format)) $content_type = 'text/html';
@@ -950,15 +958,10 @@ EOF;
 
                // Affect values to objects
                if ($format == 'html') $format = $this->format_html;
-               #bye($this->params['format']);
-#bye(preg_match('/^(.*?)\.html$/',$this->params['format']));
-               // Set _nopage
-               if (preg_match('/^(.*?)\.html$/',$this->format_html)) if (preg_match('/^(.*?)\.html$/',$format,$m)) {
-                       $format = $m[1];
-               } else {
-                       $this->_nopage = true;
-               }
                $this->format($format);
+
+               // Post defaults values
+               if (empty($this->ext)) $this->ext = $format;
                $this->method_post_accept_decode();
                $this->is_html = strpos($content_type,'html') ? true : false;
                $this->db->is_html = $this->is_html;