From 1d0f885c1a68e7442f7189f08fc69cd2d034a1a6 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Tue, 3 Apr 2018 15:12:32 +0100 Subject: [PATCH] lib/postgres/meta.sql --- etc/vim/source/vars.vim | 1 - lib/php/mime.php | 2 +- lib/php/nb.php | 15 --------------- lib/postgres/host.sql | 1 - lib/postgres/host_info.sql | 1 - lib/postgres/lang.sql | 3 --- lib/postgres/meta.sql | 13 +++++++++++++ lib/postgres/zipcode.sql | 4 ---- 8 files changed, 14 insertions(+), 26 deletions(-) create mode 100644 lib/postgres/meta.sql diff --git a/etc/vim/source/vars.vim b/etc/vim/source/vars.vim index a83dcd79..22fdcf67 100644 --- a/etc/vim/source/vars.vim +++ b/etc/vim/source/vars.vim @@ -11,7 +11,6 @@ let mimeCheck = { \,'haproxy.cfg' : 'haproxy -c -f' \,'haproxy' : 'haproxy -c -f' \,'html' : 'xmllint --noout --html' - \,'id' : 'cmd_check' \,'init' : 'init-checkconf' \,'json' : 'ruby -rjson -e ''puts JSON.parse(File.read(ARGV[0]))''' \,'perl' : 'perl -c -w' diff --git a/lib/php/mime.php b/lib/php/mime.php index 546072bc..a246754b 100644 --- a/lib/php/mime.php +++ b/lib/php/mime.php @@ -1,7 +1,7 @@ SHELL_REPLACE nb_api '/pub/mime/ls/type,ext.php_hash?align=0&limit=5' | sed "s/^/$(printf '\t\t')/" +#>SHELL_REPLACE nb_api '/pub/mime/ls/type,ext.php_hash' | sed "s/^/$(printf '\t\t')/" "application/applixware" => "aw", "application/atomcat+xml" => "atomcat", "application/atomsvc+xml" => "atomsvc", diff --git a/lib/php/nb.php b/lib/php/nb.php index 11ff9306..167a5f46 100644 --- a/lib/php/nb.php +++ b/lib/php/nb.php @@ -18,27 +18,12 @@ class NB { const NB_ROOT = NB_ROOT; protected static $content_types_aliases = array( - #>_SHELL_REPLACE dbq db=$NB_DB table="SELECT type,ext FROM mime_type WHERE ext IN ('json','csv','txt','yaml','xml','html','doc','xls')" 'text' => 'txt', 'human' => 'txt', 'table' => 'html', 'div' => 'html', - #<_SHELL_REPLACE ); - # NB 19.01.18: TODEL -# NB 19.01.18 protected static $content_types = array( -# NB 19.01.18 'json' => 'text/json', -# NB 19.01.18 'doc' => 'application/msword', -# NB 19.01.18 'xls' => 'application/vnd.ms-excel', -# NB 19.01.18 'xml' => 'application/xml', -# NB 19.01.18 'txt' => 'text/plain', -# NB 19.01.18 'csv' => 'text/csv', -# NB 19.01.18 'html' => 'text/html', -# NB 19.01.18 'yaml' => 'text/yaml', -# NB 19.01.18 'php' => 'text/x-php', -# NB 19.01.18 ); - public function __construct($opt = array()) { # Deep merge of vars diff --git a/lib/postgres/host.sql b/lib/postgres/host.sql index f1e3bd1a..d161990d 100644 --- a/lib/postgres/host.sql +++ b/lib/postgres/host.sql @@ -4,4 +4,3 @@ CREATE VIEW host AS FROM host_info GROUP BY host ; -GRANT ALL ON hostGRANT ALL ON ALL TABLES IN SCHEMA public TO TO nico,www; diff --git a/lib/postgres/host_info.sql b/lib/postgres/host_info.sql index 18b4ab59..a9123ef2 100644 --- a/lib/postgres/host_info.sql +++ b/lib/postgres/host_info.sql @@ -11,4 +11,3 @@ CREATE INDEX IF NOT EXISTS host_info_host ON host_info USING btree (host); CREATE INDEX IF NOT EXISTS host_info_key ON host_info USING btree (key); CREATE INDEX IF NOT EXISTS host_info_val ON host_info USING btree (val); CREATE INDEX IF NOT EXISTS host_info_updated ON host_info USING btree (updated); -GRANT ALL ON host_info TO nico,www; diff --git a/lib/postgres/lang.sql b/lib/postgres/lang.sql index a892c1fe..366cdf6f 100644 --- a/lib/postgres/lang.sql +++ b/lib/postgres/lang.sql @@ -3,9 +3,6 @@ CREATE TABLE IF NOT EXISTS lang ( id char(3) PRIMARY KEY, name varchar(60) ); -GRANT ALL ON TABLE lang TO www; -GRANT ALL ON TABLE lang TO nico; -GRANT ALL ON TABLE lang TO root; BEGIN TRANSACTION; DELETE FROM lang; COPY lang FROM PROGRAM 'curl -s http://download.geonames.org/export/dump/iso-languagecodes.txt \ diff --git a/lib/postgres/meta.sql b/lib/postgres/meta.sql new file mode 100644 index 00000000..b894224f --- /dev/null +++ b/lib/postgres/meta.sql @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS meta; +CREATE TABLE meta ( + cat VARCHAR(200), + key VARCHAR(100) NOT NULL, + val VARCHAR(500) NOT NULL, + updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + -- PRIMARY KEY (cat,key,updated) + PRIMARY KEY (cat,key) +); +CREATE INDEX IF NOT EXISTS meta_cat ON meta USING btree (cat); +CREATE INDEX IF NOT EXISTS meta_key ON meta USING btree (key); +CREATE INDEX IF NOT EXISTS meta_val ON meta USING btree (val); +CREATE INDEX IF NOT EXISTS meta_updated ON meta USING btree (updated); diff --git a/lib/postgres/zipcode.sql b/lib/postgres/zipcode.sql index 3dec4592..3b2f4e76 100644 --- a/lib/postgres/zipcode.sql +++ b/lib/postgres/zipcode.sql @@ -18,10 +18,6 @@ CREATE INDEX IF NOT EXISTS zipcode_code_idx ON zipcode (code); CREATE INDEX IF NOT EXISTS zipcode_country_idx ON zipcode (country); CREATE INDEX IF NOT EXISTS zipcode_name_idx ON zipcode (name); -GRANT ALL ON TABLE zipcode TO www; -GRANT ALL ON TABLE zipcode TO nico; -GRANT ALL ON TABLE zipcode TO root; - BEGIN TRANSACTION; DELETE FROM zipcode; COPY zipcode FROM PROGRAM 'curl -s http://download.geonames.org/export/zip/allCountries.zip | zcat | sed "s,\\\\,\\\\\\\\,g"' WITH (format 'text', NULL ''); -- 2.47.3