]> lifelog.hopto.org Git - LifeLog.git/commitdiff
upd.
authorWill Budic <redacted>
Wed, 26 Feb 2020 10:51:26 +0000 (21:51 +1100)
committerWill Budic <redacted>
Wed, 26 Feb 2020 10:51:26 +0000 (21:51 +1100)
Current Development Check List.md
htdocs/cgi-bin/config.cgi

index 28d5e147de26a4f2150cba1adc247a106ab9f206..8682969f473d4ece6d1793c03ad73ffecdc1ba99 100644 (file)
@@ -58,6 +58,11 @@ This version is not compatible in data structure to prior versions. Data migrati
 
 ## Planned New Possible Features of Minor Relevance
 
+* Plugin subpages.
+  * Configured in main.cnf
+  * Appear on menu or as dropdouwn in the header.
+  * Downloaded/Configurated from the configuration page.
+* View save feature. Where you name and save to config or session a dropdown of views.
 * Fit to page log. Making log subpage scrollable rather than whole page to see the bottom.
 * Make session timeot sub pages aware via JSON.
 * Multiple category assignment table (set via hashtags and end of a post).
index ca19915b3ec36d7da9cbdbba89927316fc3decdc..d7d3131afc02dc889e2592313e203f1ce2ed3f07 100755 (executable)
@@ -65,6 +65,9 @@ my $csvp   = $cgi->param('csv');
 if($cgi->param('bck')){
     &backup;
 }
+elsif($cgi->param('data_bck')){
+    &restore;
+}
 elsif($cgi->param('data_cat')){
     &importCatCSV;
 }elsif($cgi->param('data_log')){
@@ -389,7 +392,7 @@ print qq(
                 <tr><td><input type="button" onclick="return fetchBackup();" value="Fetch"/><hr></td></tr>
 
                 <tr><td><div id="div_backups">$bck_list</div><hr></td></tr>
-                <tr><td><input type="button" onclick="return deleteBackup();" value="Delete"/> <input type="file" name="data_bck" /><input type="button" onclick="return restoreBackup();" value="Restore"/><hr></td></tr>
+                <tr><td><input type="button" onclick="return deleteBackup();" value="Delete"/> <input type="file" name="data_bck" />&nbsp;&nbsp;<input type="Submit" onclick="return true;restoreBackup();" value="Restore"/><hr></td></tr>
 
 
                 <tr><td><H3>CSV File Format</H3></td></tr>
@@ -941,21 +944,48 @@ sub changeSystemSettings {
 sub backup {
 
 
-   my $ball = 'bck_'.$today->strftime('%Y%m%d%H%M%S_')."$dbname.osz";
-   my $pipe = "tar czf - ".&Settings::logPath.'main.cnf' ."$database | openssl enc -k $pass:$userid -e -des-ede3-cfb -out ".Settings::logPath().$ball;
-   `$pipe`;
+   my $ball = 'bck__'.$today->strftime('%Y%m%d%H%M%S_')."$dbname.osz";
+   my $pipe = "tar czf - ".&Settings::logPath.'main.cnf' ." $database | openssl enc -k $pass:$userid -e -des-ede3-cfb -pbkdf2 -out ".Settings::logPath().$ball;
+   my $rez = `$pipe`;
+
+  print $cgi->header;
+            print $cgi->start_html;
+
+   print $pipe;
 
-    print $cgi->header(-type=>"application/octet-stream", -attachment=>"$ball");
-    select(STDOUT); $| = 1;   #unbuffer STDOUT
-    binmode STDOUT;
-    open (TAR, '<', Settings::logPath().$ball);
-    print <TAR>;
-    close TAR;
 
-     #LifeLogException->throw("Backup feature currently under development! Serverside created files is -> $ball");
+
+            print $cgi->end_html;
+       exit;
 
 }
 
+sub restore {
+
+    my $hndl = $cgi->upload("data_bck");
+    my $pipe;
+    try{
+
+
+        print $cgi->header;
+            print $cgi->start_html;
+
+
+        my $pipe;
+        open ($pipe,  "| openssl enc -k $pass:$userid -d -des-ede3-cfb -pbkdf2 -in /dev/stdin 2>/dev/null | tar zt");#1>/dev/null");
+            while(<$hndl>){print $pipe $_;};
+        close $pipe;
+
+            print $cgi->end_html;
+       exit;
+
+
+    }
+    catch{
+        LifeLogException->throw(error=>"Restore failed! hndl->$hndl",show_trace=>&Settings::debug);
+    };
+
+}
 
 sub exportToCSV {
     try{