From: Nicolas Boisselier Date: Sat, 25 Nov 2017 04:39:54 +0000 (+0000) Subject: disable etc/dbq/zz-sqlite.php etc/dbq/zzz-all.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=845f2eb2e47d51d714c6ed112f01b201706492b7;p=nb.git disable etc/dbq/zz-sqlite.php etc/dbq/zzz-all.php --- diff --git a/etc/dbq/zz-sqlite.php b/etc/dbq/zz-sqlite.php deleted file mode 100644 index 0fbd1a06..00000000 --- a/etc/dbq/zz-sqlite.php +++ /dev/null @@ -1,47 +0,0 @@ - $db) { - if (1 - and !empty($db['type']) and $db['type'] == 'sqlite' - and !empty($db['host']) - ) $host_already_exists[$db['host']] = $id; - } - - foreach (nb::ls_dir($DIR_SQLITE,'\.db$') as $file) { - - if (strpos($file,'_conflict-')) continue; - - if (isset($host_already_exists["$DIR_SQLITE/$file"])) { - $DBQ[$host_already_exists["$DIR_SQLITE/$file"]]['sql_pre'][] = 'PRAGMA journal_mode=OFF'; - continue; - } - - $name = basename($file,'.db'); - $id = "${name}-sqlite"; - - if (!isset($DBQ[$id])) $DBQ[$id] = [ - 'host' => "$DIR_SQLITE/$file", - 'type' => 'sqlite', - 'title' => Db::prettyText($name), - '_import' => $name - ]; - } - -} - -unset($DIR_SQLITE,$host_already_exists); -?> diff --git a/etc/dbq/zz-sqlite.php.disable b/etc/dbq/zz-sqlite.php.disable new file mode 100644 index 00000000..0fbd1a06 --- /dev/null +++ b/etc/dbq/zz-sqlite.php.disable @@ -0,0 +1,47 @@ + $db) { + if (1 + and !empty($db['type']) and $db['type'] == 'sqlite' + and !empty($db['host']) + ) $host_already_exists[$db['host']] = $id; + } + + foreach (nb::ls_dir($DIR_SQLITE,'\.db$') as $file) { + + if (strpos($file,'_conflict-')) continue; + + if (isset($host_already_exists["$DIR_SQLITE/$file"])) { + $DBQ[$host_already_exists["$DIR_SQLITE/$file"]]['sql_pre'][] = 'PRAGMA journal_mode=OFF'; + continue; + } + + $name = basename($file,'.db'); + $id = "${name}-sqlite"; + + if (!isset($DBQ[$id])) $DBQ[$id] = [ + 'host' => "$DIR_SQLITE/$file", + 'type' => 'sqlite', + 'title' => Db::prettyText($name), + '_import' => $name + ]; + } + +} + +unset($DIR_SQLITE,$host_already_exists); +?> diff --git a/etc/dbq/zzz-all.php b/etc/dbq/zzz-all.php deleted file mode 100644 index 3953de56..00000000 --- a/etc/dbq/zzz-all.php +++ /dev/null @@ -1,50 +0,0 @@ - ':memory:', - 'type' => 'sqlite', - 'name' => 'all', - 'pdo' => '', - 'default_table' => '', -# NB 20.01.17 '_import' => ['nb'], - 'order' => '10', - 'options' => [ - PDO::ATTR_PERSISTENT => true, - ], - 'tables' => [], - 'types' => [ - 'sql_pre' => [], - ], - 'sql_pre' => [ - #'PRAGMA synchronous = NORMAL', - 'PRAGMA busy_timeout = 10000', - 'PRAGMA journal_mode = MEMORY', - ], -]; - -foreach ($DBQ as $id => $db) { - if (0 - - or empty($db['type'] ) - or $db['type']!='sqlite' - - or empty($db['host'] ) - or !is_readable($db['host']) - or !strpos($db['host'],'.db') - - ) continue; - - $fname = basename($db['host'],'.db'); - $fname = preg_replace('/\..*$/','',basename($db['host'])); - - $DBQ['all']['attach'][$fname] = $db['host']; - $DBQ['all']['_import'] = empty($DBQ['all']['_import']) ? [] : (array)$DBQ['all']['_import']; - $DBQ['all']['_import'][] = $id; - -} -if (!isset($DBQ['all']['_import']) or count($DBQ['all']['_import'])<2) unset($DBQ['all']); diff --git a/etc/dbq/zzz-all.php.disable b/etc/dbq/zzz-all.php.disable new file mode 100644 index 00000000..3953de56 --- /dev/null +++ b/etc/dbq/zzz-all.php.disable @@ -0,0 +1,50 @@ + ':memory:', + 'type' => 'sqlite', + 'name' => 'all', + 'pdo' => '', + 'default_table' => '', +# NB 20.01.17 '_import' => ['nb'], + 'order' => '10', + 'options' => [ + PDO::ATTR_PERSISTENT => true, + ], + 'tables' => [], + 'types' => [ + 'sql_pre' => [], + ], + 'sql_pre' => [ + #'PRAGMA synchronous = NORMAL', + 'PRAGMA busy_timeout = 10000', + 'PRAGMA journal_mode = MEMORY', + ], +]; + +foreach ($DBQ as $id => $db) { + if (0 + + or empty($db['type'] ) + or $db['type']!='sqlite' + + or empty($db['host'] ) + or !is_readable($db['host']) + or !strpos($db['host'],'.db') + + ) continue; + + $fname = basename($db['host'],'.db'); + $fname = preg_replace('/\..*$/','',basename($db['host'])); + + $DBQ['all']['attach'][$fname] = $db['host']; + $DBQ['all']['_import'] = empty($DBQ['all']['_import']) ? [] : (array)$DBQ['all']['_import']; + $DBQ['all']['_import'][] = $id; + +} +if (!isset($DBQ['all']['_import']) or count($DBQ['all']['_import'])<2) unset($DBQ['all']);