From: wbudic Date: Thu, 2 Sep 2021 10:49:23 +0000 (+1000) Subject: Bug 63.1 fixed. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=c020308eba241ba5253515ad40aa4beb53a5917f;p=LifeLog.git Bug 63.1 fixed. --- diff --git a/htdocs/cgi-bin/config.cgi b/htdocs/cgi-bin/config.cgi index 64c0dac..e1ece41 100755 --- a/htdocs/cgi-bin/config.cgi +++ b/htdocs/cgi-bin/config.cgi @@ -31,6 +31,7 @@ require Settings; $CGI::POST_MAX = 1024 * 15000; ## + my ($RDS,$TR_STATUS,$LOGOUT,$ERROR) = ("","",0,""); my $sys = `uname -n`; my $db = Settings::fetchDBSettings(); @@ -46,15 +47,16 @@ my $tz = $cgi->param('tz'); my $csvp = $cgi->param('csv'); my $CID = 'rowid'; $CID = 'ID' if Settings::isProgressDB(); -exportToCSV() if ($csvp); -if($cgi->param('bck')) {&backup} -elsif($_=$cgi->param('bck_del')) {backupDelete($_)} -elsif($cgi->param('data_bck')) {&restore;} -elsif($_=$cgi->param('bck_file')) {restore($_)} -elsif($cgi->param('data_cat')) {&importCatCSV} -elsif($cgi->param('data_log')) {&importLogCSV} + exportToCSV() if ($csvp); + if($cgi->param('bck')) {&backup} #?bck=1 (js set) + elsif($_=$cgi->param('bck_del')) {backupDelete($_)} #?bck_del=... (js set) + elsif($cgi->param('bck_upload')) {&restore} #upload backup (form set) + elsif($_=$cgi->param('bck_file')) {restore($_)} + elsif($cgi->param('data_cat')) {&importCatCSV} + elsif($cgi->param('data_log')) {&importLogCSV} + my $stmtCat = 'SELECT * FROM CAT ORDER BY ID;'; @@ -387,7 +389,7 @@ else{ } my $inpRestore = qq(Local File:   -  ); +  ); my $inpCVS = qq(  ); @@ -417,11 +419,13 @@ print qq(
$bck_list

-
+ Notice - Uploads might fail on large backups, corrupt file, and/or due to browser settings.
+ $inpRestore -
-
- + +
+ +

CSV File Format

Notice: (This is an obsolete feature, use is not recommended!) @@ -1244,7 +1248,7 @@ sub restore { my $file = shift; my ($tar,$pipe,@br,$stdout,$b_db); my $pass = Settings::pass(); - my $hndl = $cgi->param('data_bck'); + my $hndl = $cgi->param('bck_upload'); my $dbck = &Settings::logPath."bck/"; `mkdir $dbck` if (!-d $dbck); my $stage = "Initial"; my $stamp = $today."\t"; $stamp =~ s/T/ /g; @@ -1260,11 +1264,11 @@ my $stdout = capture_stdout { if($file){ #Open handle on server where backup is to be restored. my $f = &Settings::logPath.$file; open($hndl, '<', $f) or die "Can't open $f: $!"; - print $fhLog $stamp, "Uploading backup file -> $file\n"; + print $fhLog $stamp, "Reading on server backup file -> $file\n"; $tar = $dbck.$file; } else{ - print $fhLog $stamp, "Reading on server backup file -> $hndl\n"; + print $fhLog $stamp, "Uploading to server backup file -> $hndl\n"; $tar = $dbck.$hndl; } $tar =~ s/osz$/tar/; @@ -1454,6 +1458,9 @@ catch{ $ERROR = "
Full Restore Failed!
$@ \n"; $ERROR .= "br:[@br]" if(@br); $ERROR .= "
Failed at stage: $stage"; + openlog(Settings::dsn(), 'cons,pid', "user"); + syslog('err', '%s', $ERROR); + closelog(); }; my $back = $cgi->url( -relative => 1 ); @@ -1666,35 +1673,3 @@ sub error { exit; } - - my %dates = (); - #Hash is unreliable for returning sequential order of keys so array must do. - my @dlts = (); - my $cntr_del =0; - my $existing; - my @row; - - getHeader(); - print "
Started transaction!\n";
-
-        $db->do('BEGIN TRANSACTION;');
-        # Check for duplicates, which are possible during imports or migration as internal rowid is not primary in log.
-        # @TODO This should be done through an view?
-        if(Settings::isProgressDB()){
-            $dbs = Settings::selectRecords($db, 'SELECT ID, DATE FROM LOG ORDER BY DATE;');
-        }else{
-            $dbs = Settings::selectRecords($db, 'SELECT rowid, DATE FROM LOG ORDER BY DATE;');
-        }
-        while(@row = $dbs->fetchrow_array()) {
-            my $existing = $dates{$row[0]};
-            if($existing && $existing eq $row[1]){
-                $dlts[$cntr_del++] = $row[0];
-            }
-            else{
-                $dates{$row[0]} = $row[1];
-            }
-        }
-
-
-
-1;
\ No newline at end of file
diff --git a/htdocs/cgi-bin/main.cgi b/htdocs/cgi-bin/main.cgi
index 526183e..5df22c5 100755
--- a/htdocs/cgi-bin/main.cgi
+++ b/htdocs/cgi-bin/main.cgi
@@ -763,7 +763,7 @@ my $auto_logoff = &Settings::autoLogoff;
 if($isPUBViewMode){
 }
 else{
-$log_output .= <<_TXT;
+$log_output .= <Show All hidden ➔
 
 
@@ -777,7 +777,7 @@ $log_output .= <<_TXT;
      
              
      
-    
+    
     
 
 
@@ -787,8 +787,8 @@ $log_output .= <<_TXT;
     
     
     
-);
-_TXT
+
+HTML
 };
 
 
diff --git a/htdocs/cgi-bin/system/modules/Settings.pm b/htdocs/cgi-bin/system/modules/Settings.pm
index ad53c35..d3447ff 100644
--- a/htdocs/cgi-bin/system/modules/Settings.pm
+++ b/htdocs/cgi-bin/system/modules/Settings.pm
@@ -27,8 +27,9 @@ use experimental 'switch';
 BEGIN {
    sub handle_errors {
       my $msg = shift;
-      print "

LifeLog Server Error

"; - print "
@[$ENV{PWD}].Error: $msg
"; + print "

LifeLog Server Error

"; + print "
@[$ENV{PWD}].Error: $msg
"; + } set_message(\&handle_errors); }