From 38e60334206adba20ba13108046106d24e1a5fba Mon Sep 17 00:00:00 2001 From: Will Budic Date: Wed, 4 Mar 2020 05:13:39 +1100 Subject: [PATCH] Removed --- dbLifeLog/database.cnf | 81 ---------- dbLifeLog/databaseAnonsTest.cnf | 49 ------ dbLifeLog/databaseInventory.cnf | 56 ------- dbLifeLog/databaseInventoryDATA.cnf | 8 - dbLifeLog/export_log.csv | 43 ----- htdocs/cgi-bin/CNF_DBDev.pl | 216 -------------------------- htdocs/cgi-bin/CNF_SnippetsTesting.pl | 47 ------ htdocs/cgi-bin/CNF_test_anons.pl | 63 -------- htdocs/cgi-bin/CNF_tester.pl | 47 ------ 9 files changed, 610 deletions(-) delete mode 100644 dbLifeLog/database.cnf delete mode 100644 dbLifeLog/databaseAnonsTest.cnf delete mode 100644 dbLifeLog/databaseInventory.cnf delete mode 100644 dbLifeLog/databaseInventoryDATA.cnf delete mode 100644 dbLifeLog/export_log.csv delete mode 100755 htdocs/cgi-bin/CNF_DBDev.pl delete mode 100755 htdocs/cgi-bin/CNF_SnippetsTesting.pl delete mode 100755 htdocs/cgi-bin/CNF_test_anons.pl delete mode 100755 htdocs/cgi-bin/CNF_tester.pl diff --git a/dbLifeLog/database.cnf b/dbLifeLog/database.cnf deleted file mode 100644 index db60ee9..0000000 --- a/dbLifeLog/database.cnf +++ /dev/null @@ -1,81 +0,0 @@ - -!CNF1.1 -This is the main configuration file for the LifeLog applications settings. -https://github.com/wbudic/LifeLog -This is an Open Source License project -> https://choosealicense.com/licenses/isc/ -The credential format:< , dont enable here using AUTO_LOGIN option bellow, use config in app. -<>> -# List command anon with the name of 'list_cmd'. -<>> -<<> -<>> - - - -<> -<> -<> -<> -<> - -<> - diff --git a/dbLifeLog/databaseAnonsTest.cnf b/dbLifeLog/databaseAnonsTest.cnf deleted file mode 100644 index 27c6c49..0000000 --- a/dbLifeLog/databaseAnonsTest.cnf +++ /dev/null @@ -1,49 +0,0 @@ -!CNF1.1 -<>> -<>> -<>> -<>> -<>> -<> -<> - -<>> -<>> -<<>> - -<<$HELP>> - - -<>> - -<>> \ No newline at end of file diff --git a/dbLifeLog/databaseInventory.cnf b/dbLifeLog/databaseInventory.cnf deleted file mode 100644 index c90f4f5..0000000 --- a/dbLifeLog/databaseInventory.cnf +++ /dev/null @@ -1,56 +0,0 @@ -!CNF1.1 -Sample database and data. Presentnting a Inventory database of itmes. Having multiple categories. -<<> - -<> - -<> - - -<> - -<> - -/** - * Following file contains rest of data for ITEMS table. - */ -<>> - - diff --git a/dbLifeLog/databaseInventoryDATA.cnf b/dbLifeLog/databaseInventoryDATA.cnf deleted file mode 100644 index 5f64215..0000000 --- a/dbLifeLog/databaseInventoryDATA.cnf +++ /dev/null @@ -1,8 +0,0 @@ -!CNF1.1 -Sample database data tagged properties. -See databaseInventory.cnf for data structure. -<> diff --git a/dbLifeLog/export_log.csv b/dbLifeLog/export_log.csv deleted file mode 100644 index f4134c4..0000000 --- a/dbLifeLog/export_log.csv +++ /dev/null @@ -1,43 +0,0 @@ -ID_CAT,DATE,LOG,AMMOUNT -3,2018-08-21T18:13:55,"DB Created!", -28,"2018-08-21 20:06:29","Noisy Radio -> https://www.youtube.com/watch?v=fhq7mrl6Ub8 ", -28,"2018-08-21 20:51:00","The band - The Weight", -28,"2018-08-22 19:12:36","Maria Kurak Friends.", -1,"2018-08-24 22:27:10","Search 1927 - If I Could (1988)", -28,"2018-08-26 19:12:18","It works! ", -28,"2018-08-27 12:36:20","Working from Wed this week.", -28,"2018-07-31 18:59:23","Cant find Iva? Where is she gone?", -28,"2018-09-07 15:52:05","Spring Cleaning 2018. Fridge Pantry. It is true, the longer in a kitchen Chef. More, and more tasks attached.", -28,"2018-09-14 05:00:00","Was allowed day off. Hand injury! Got [A] classified, day before.", -28,"2018-09-15 07:00:00","Zoran, my father died.", -28,"2018-09-20 11:00:00",Funeral, -28,"2018-10-19 16:49:35","Taking a week of holiday. Starts on 22, Monday.","" -28,"2018-10-19 21:20:56","Lost mobile and wallet today. Returned!","" -35,"2018-10-20 08:17:32","test Income",20000.5 -32,"2018-10-20 08:18:05","test expense",35690.65 -35,"2018-10-20 08:18:37",Income,22334422.89 -9,"2018-10-22 16:44:29","Toyota Airbag Recall done.","" -28,"2018-10-30 05:30:00","Went to work, sick Alcohol poisoning. End of holiday. Never again, drink whiskey.","" -28,"2018-11-02 18:09:06","Today, finally good. So much it takes to recover. -Think have low level tolerance to it over 30% in bottle, as my liver alarms me.","" -32,"2016-07-08 00:00:00","Gas Bottle Purchase",24 -32,"2017-02-13 00:00:00","Gas Bottle Purchase",24 -32,"2018-04-16 00:00:00","Gas Bottle Purchase",27 -32,"2018-04-16 00:00:00","PHFZR → Locket -",15 -9,"2018-11-04 08:00:00","Bondi - Event Sculpture By The Sea. Last day Sunday. Full of people this early, hard to find parking.",2 -28,"2018-11-06 04:45:00","Hardly woke up, feeling bad again.","" -9,"2018-11-09 16:26:27","Outage of Internet. Reported! -I am TT1-1763730224201 -Call 1800117969 operator 4.","" -32,"2018-11-22 14:15:00","Gas Bottle",29 -9,"2018-12-12 14:00:00","Dawn farewell party. (work)","" -32,"2018-12-15 12:55:28","Electricity Bill ",260.8 -1,"2018-12-17 10:57:59","https://en.wikipedia.org/wiki/Longjing_tea - -Destination Flavour China","" -9,"2018-12-20 14:45:23","Outage of Internet again. -Since yesterday. After loud Thunder.","" -28,"2018-12-21 18:36:1","Banned! To post. To old for anything! ","" -9,"2014-11-13 13:48:05","TED - What your doctor won’t disclose -https://youtu.be/oxYU5GNngnk","" diff --git a/htdocs/cgi-bin/CNF_DBDev.pl b/htdocs/cgi-bin/CNF_DBDev.pl deleted file mode 100755 index 986c45d..0000000 --- a/htdocs/cgi-bin/CNF_DBDev.pl +++ /dev/null @@ -1,216 +0,0 @@ -#!/usr/bin/perl -w -# -# Programed by: Will Budic -# Open Source License -> https://choosealicense.com/licenses/isc/ -# -use strict; -use warnings; -use Try::Tiny; - -use DateTime; -use DateTime::Format::SQLite; -use DateTime::Duration; -use DBI; - -#DEFAULT SETTINGS HERE! -use lib "system/modules"; -use lib $ENV{'PWD'}.'/htdocs/cgi-bin/system/modules'; -require CNFParser; -require Settings; - - -my ($dsn, $db,$res,$stm,$dbver,$st,$cnf); -my $today = DateTime->now; - $today->set_time_zone( &Settings::timezone ); - - -&testSettingsForStatementsInLifeLogDB; - - -sub testSettingsForStatementsInLifeLogDB { - - $cnf = CNFParser->new(); - $dsn= "DBI:SQLite:dbname=".$ENV{'PWD'}.'/dbLifeLog/data_admin_log.db'; - $db = DBI->connect($dsn, 'admin', 'admin', { RaiseError => 1 }) or die "Error->". &DBI::errstri; - - - print "Log records count:",Settings::selectRecords($db, 'select count(*)from LOG;')->fetchrow_array(),"\n"; - print "--Sample--\n", - - my $pst1 = Settings::selectRecords($db, 'select rowid, date, log from LOG order by date desc limit 10;'); - my $st = $db->prepare('select rowid, date, log from LOG order by date desc;'); - $st->execute() or die "

ERROR with->$_

"; - - - foreach (my @r = $pst1->fetchrow_array()) { - my $lid = $r[0]; - my $dat = $r[1]; - my $log = $r[2]; - if(length($log)>60){ - print sprintf("%4d %s %.60s...\n", $lid, $dat, $log); - }else{ - print sprintf("%4d %s %0s\n", $lid, $dat, $log); - } - - } - - my $pst = Settings::selectRecords($db,"SELECT name FROM sqlite_master WHERE type='table';"); - my %curr_tables = (); - while(my @r = $pst->fetchrow_array()){ - $curr_tables{$r[0]} = 1; - } - my $check; if ($curr_tables{"LOG"}){$check = 'yes'} else{ $check = 'no'}; - print "Has Log table? ->", $check, "\n"; - if ($curr_tables{"DOODLE"}){$check = 'yes'} else{ $check = 'no'}; - print "DOODLE table? ->", $check, "\n"; - - $check = Settings::selectRecords($db,"SELECT ID FROM CAT WHERE name == 'System Log';")->fetchrow_array(); - $check = 0 if not $check; - print "0==$check\n"; - $db->disconnect(); - -exit; -} - -$cnf = CNFParser->new(); - -$cnf->parse($ENV{'PWD'}."/dbLifeLog/databaseInventory.cnf"); - - - -$dsn = "DBI:SQLite:dbname=".$ENV{'PWD'}.'/dbLifeLog/'.$cnf->constant('$DATABASE'); - - $db = DBI->connect($dsn, $cnf->constant('$LOGIN_USER'), $cnf->constant('$LOGIN_PASS'), { RaiseError => 1 }) - or die "Error->". &DBI::errstri ; -$dbver = $cnf->initiDatabase($db); - - -$dsn= "DBI:SQLite:dbname=".$ENV{'PWD'}.'/dbLifeLog/'.$cnf->constant('$DATABASE'); - -print "Acessing: $dsn\n"; - -## We have all the table statments, so let's check issue them first. -foreach my $tbl ($cnf->tables()){ - - if($cnf->tableExists($db, $tbl)){ - print "Table -> $tbl found existing.\n"; - } - else{ - $stm = $cnf->tableSQL($tbl); - - if($db->do($stm)){ - print "Created table: $tbl \n"; - } - else{ - print "Failed -> \n$stm \n"; - } - } - -} - - - -foreach my $tbl ($cnf->dataKeys()){ - my ($sel,$ins, $seu, $upd, @prm, @arr);#locals - try{ - print "Processing table data for ->", $tbl , "\n"; - $stm = $cnf->tableSQL($tbl); - - if(!$stm){ - print "Failed to obtain table statment for table data -> $tbl\n"; - }else{ - @arr = getStatements($tbl, $stm); - $sel = $db->prepare($arr[0]); - $ins = $db->prepare($arr[1]); - $seu = $db->prepare($arr[2]); - $upd = $db->prepare($arr[3]); - foreach my $ln ($cnf->data($tbl)){ - #print "dataln-> $ln\n"; - @prm = (); - foreach my $p (split(/','/,$ln)){ - $p =~ s/^'|'$//g; - push @prm, $p; - } - $sel->execute(@prm); - my @ret = $sel -> fetchrow_array(); - if(@ret){ - print "Exists -> ".delim(@prm)," <- UID: $ret[0]", "\n"; - } - else{ - my $uid = shift @prm; - $seu->execute($uid); - @ret = $seu -> fetchrow_array(); - if(@ret){ - push @prm, $uid; - @ret = $upd->execute(@prm); - print "Updated -> ".delim(@prm), "\n"; - }else{ - unshift @prm, $uid; - $ins->execute(@prm); - print "Added -> ".delim(@prm), "\n"; - } - } - } - } - - }catch{ - print "Error:$_\n"; - print "Error on->$tbl exeprms[",delim(@prm),"]\n"; - foreach my $ln ($cnf->data($tbl)){ - print "dataln-> $ln\n"; - } - } - -} - -sub delim { - my $r; - foreach(@_){$r.=$_.'`'} - $r=~s/`$//; - return $r; -} - -sub getStatements { - - my ($tbl, $stm) = @_; - my @ret = (); - my ($sel,$ins, $seu, $upd, $upe); - - $sel = "SELECT * FROM $tbl WHERE "; - $ins = "INSERT INTO $tbl VALUES("; - $upd = "UPDATE $tbl SET "; - - $stm =~ s/^.*\(\s+//g; - $stm =~ s/\n\s*|\n\);/\n/g; - $stm =~ s/\);//g; - - # print "<<$stm>>\n"; - - foreach my $n (split(/,\s*/,$stm)){ - $n =~ /(^\w+)/; - #print $1, "\n"; - $sel .= "$1=? AND "; - $seu .= "SELECT * FROM $tbl WHERE $1=?;" if !$seu; - $ins .= "?,"; - if (!$upe){ - $upe = " WHERE $1=?"; - }else{ - $upd .= "$1=?,"; - } - } - $sel =~ s/\sAND\s$/;/g; - $ins =~ s/,$/);/g; - $upd =~ s/,$/$upe/g; - - push @ret, $sel; - push @ret, $ins; - push @ret, $seu; - push @ret, $upd; - - # print delim(@ret)."\n"; - - return @ret; -} - - -1; diff --git a/htdocs/cgi-bin/CNF_SnippetsTesting.pl b/htdocs/cgi-bin/CNF_SnippetsTesting.pl deleted file mode 100755 index 93ec55b..0000000 --- a/htdocs/cgi-bin/CNF_SnippetsTesting.pl +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/perl -w -# -# Programed by: Will Budic -# Open Source License -> https://choosealicense.com/licenses/isc/ -# -use strict; -use warnings; -use DBI; -use Exception::Class; - - -use lib "system/modules"; -use lib $ENV{'PWD'}.'/htdocs/cgi-bin/system/modules'; - -require Settings; - - -my $dsn = "DBI:SQLite:dbname=/home/will/dev/LifeLog/dbLifeLog/data_admin_log.db"; -my $db = DBI->connect( $dsn, "admin", "admin", { PrintError => 0, RaiseError => 1 } ) - or Exception->throw("Connect failed [$_]"); - -Settings::getConfiguration($db,{backup_enabled=>1}); -print "backup_enabled1:[".Settings::anon('backup_enabled')."]\n"; -my @r = Settings::anons(); -print "anon_size:[".@r."]@r\n"; - - -Settings::getConfiguration($db);#in file set to 0 -print "backup_enabled2:[".Settings::anon('backup_enabled')."]\n"; -Settings::getConfiguration($db,{backup_enabled=>1});#this is later, code set. -print "backup_enabled3:[".Settings::anon('backup_enabled')."]\n"; -Settings::getConfiguration($db);#Murky waters, can't update an anon later through code. Config initially set. -print "backup_enabled4:[".Settings::anon('backup_enabled')."]\n"; - -# my $s1 ="`1`2`3`te\\`s\\`t`the best`"; - -# $s1 =~ s/\\`/\\f/g; -# #print $s1,"\n"; -# foreach ( split ( /`/, $s1) ){ -# $_ =~ s/\\f/`/g; -# print $_,"\n"; -# } -# print "Home:".$ENV{'PWD'}.$ENV{'NL'}; - - - -1; diff --git a/htdocs/cgi-bin/CNF_test_anons.pl b/htdocs/cgi-bin/CNF_test_anons.pl deleted file mode 100755 index c1da7e0..0000000 --- a/htdocs/cgi-bin/CNF_test_anons.pl +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/perl -w -# -# Programed by: Will Budic -# Open Source License -> https://choosealicense.com/licenses/isc/ -# -use strict; -use warnings; -use Try::Tiny; - -use DateTime; -use DateTime::Format::SQLite; -use DateTime::Duration; - - -#DEFAULT SETTINGS HERE! -use lib "system/modules"; - -use lib $ENV{'PWD'}.'/htdocs/cgi-bin/system/modules'; -require CNFParser; - -testAnons(); - - - -sub testAnons { - -my $cnf = CNFParser->new($ENV{'PWD'}."/dbLifeLog/databaseAnonsTest.cnf"); - -my $exe = $cnf->anons('list_cmd', $ENV{'PWD'}); -print "Exe is:$exe\n"; -$exe = `$exe`; -print "Error failed system command!" if !$exe; -#print "Listing:\n$exe\n"; - -print "--LIST OF ALL ANONS ENCOUNTERED---\n"; -my %anons = $cnf->anons(); -foreach my $k (keys %anons){ - print "Key->$k=", $anons{$k},"]\n"; -} -eval((keys %anons) == 7) or die "Error annons count mismatch!"; - -eval(length($cnf->constant('$HELP'))>0) or die 'Error missing multi-line valued constant property $HELP'; - -my $template = $cnf -> template( 'MyTemplate', ( - 'SALUTATION'=>'Mr', - 'NAME'=>'Prince Clington', - 'AMOUNT'=>"1,000,000\$", - 'CRITERIA'=>"Section 2.2 (Eligibility Chapter)" - ) - ); - -print "\n--- TEMPLATE ---\n".$template; - -### From the specs. -my $url = $cnf->anons('GET_SUB_URL',('tech','main.cgi')); -# $url now should be: https://www.tech.acme.com/main.cgi -eval ($url =~ m/https:\.*/) -or warn "Failed to obtain expected URL when querying anon -> GET_SUB_URL"; -eval ($url eq 'https://www.tech.acme.com/main.cgi') or die "Error with: $url"; -} - - -1; diff --git a/htdocs/cgi-bin/CNF_tester.pl b/htdocs/cgi-bin/CNF_tester.pl deleted file mode 100755 index 94d29ae..0000000 --- a/htdocs/cgi-bin/CNF_tester.pl +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/perl -w -# -# Programed by: Will Budic -# Open Source License -> https://choosealicense.com/licenses/isc/ -# -use strict; -use warnings; -use Try::Tiny; - -use DateTime; -use DateTime::Format::SQLite; -use DateTime::Duration; -use Text::CSV; - -#DEFAULT SETTINGS HERE! -use lib "system/modules"; -use lib $ENV{'PWD'}.'/htdocs/cgi-bin/system/modules'; -require Settings; - -my $today = DateTime->now; -$today->set_time_zone( &Settings::timezone ); -print $today; - -# use lib $ENV{'PWD'}.'/htdocs/cgi-bin/system/modules'; -# require CNFParser; - -# my $cnf = CNFParser->new(); -# $cnf->parse($ENV{'PWD'}."/dbLifeLog/database.cnf"); - -# foreach ($cnf->SQLStatments()){ -# print "$_\n"; -# } -# foreach my $p ($cnf->constants()){ - -# print "$p=", $cnf->constant($p),"\n"; -# } -# print "\n---ANNONS---\n"; -# my %anons = $cnf->anons(); -# foreach my $k (%anons){ -# print "$k=", $anons{$k},"\n" if $k; -# } -# foreach (sort keys %ENV) { -# print "$_= $ENV{$_}\n"; -# } - -### CGI END -1; -- 2.34.1