]> lifelog.hopto.org Git - LifeLog.git/commitdiff
log varchar limit was overun. Resized to 1024.
authorWill Budicm <redacted>
Sun, 6 Dec 2020 06:49:27 +0000 (17:49 +1100)
committerWill Budicm <redacted>
Sun, 6 Dec 2020 06:49:27 +0000 (17:49 +1100)
htdocs/cgi-bin/stats.cgi
htdocs/cgi-bin/system/modules/Settings.pm

index a961395336617e830449e1f2ad6bd727b74bf6cb..c731cbc588b3694a92c64b808ce565f8921dd37c 100755 (executable)
@@ -8,9 +8,9 @@ use warnings;
 #no warnings 'uninitialized';
 
 use CGI;
-use CGI::Pretty ":standard"; #Influde style subroutine for inline CSS
 use CGI::Session '-ip_match';
 use CGI::Carp qw ( fatalsToBrowser );
+use CGI::Pretty ":standard"; #Includes style subroutine for inline CSS
 use DBI;
 use DateTime::Format::SQLite;
 use Number::Bytes::Human qw(format_bytes);
@@ -123,7 +123,6 @@ my $hardware_status = "<b>Host: </b>$hst<br>".join("\t", map { defined ? $_ : ''
    $hardware_status =~ s/\t+/<br>/gm; #TODO: This temp. resolves the regex needs to be adjusted so we join with <br>
    $hardware_status =~ s/Memory:/<br><b>Memory: <\/b>/g;   
    $hardware_status =~ s/up\s/<b>Server is up: <\/b>/g;
-   
 
 my $prc = 'ps -eo size,pid,user,command --sort -size | awk \'{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }\'';
 my $processes = `$prc | sort -u -r -`;
@@ -174,8 +173,11 @@ print qq(
 </div>);
 
 print $cgi->end_html;
-my $syslog = "<span>$hardware_status</span>"."<pre>\n".`df -h -l -x tmpfs`."</pre>";   
-&Settings::toLog($db, $syslog);
+
+$hardware_status = "<span>$hardware_status</span>"."<pre>\n".`df -h -l -x tmpfs`."</pre>";   
+Settings::toLog($db, $$hardware_status);
+
+
 $db->disconnect();
 
 }
index f825b6a3c8c2d0ae62146cf7823ea058cae158bc..1d21b57ec59e2c7e71d2ec20abe445bf462f7356 100644 (file)
@@ -116,33 +116,35 @@ try {
     $alias   = $sss->param('alias');
     $pass    = $sss->param('passw');
     $pub     = $cgi->param('pub');
+
+    ##From here we have data source set, currently Progress DB SQL and SQLite SQL compatible.
+    dbSrc($sss->param('db_source'));
+
+
     if($pub){#we override session to obtain pub(alias)/pass from file main config.
         open(my $fh, '<', logPath().'main.cnf' ) or LifeLogException->throw("Can't open main.cnf: $!");        
         while (my $line = <$fh>) {
                     chomp $line;
-                    my $v = Settings::parseAutonom('PUBLIC_LOGIN',$line);
+                    my $v = parseAutonom('PUBLIC_LOGIN',$line);
                     if($v){my @cre = split '/', $v; 
                            $alias = $cre[0];                           
                            $pass = uc crypt $cre[1], hex Settings->CIPHER_KEY;
                     }                    
-                       $v = Settings::parseAutonom('PUBLIC_CATS',$line);
+                       $v = parseAutonom('PUBLIC_CATS',$line);
                     if($v){my @cats= split(',',$v);
                         foreach(@cats){
                             $SQL_PUB .= "ID_CAT=".trim($_)." OR ";
                         }
                         $SQL_PUB =~ s/\s+OR\s+$//;
                     }
-                    last if Settings::parseAutonom('CONFIG',$line);
+                    last if parseAutonom('CONFIG',$line);
         }
         close $fh; 
         if(!$SQL_PUB){$alias=undef}       
     }
     if(!$alias){
-        print $cgi->redirect("login_ctr.cgi?CGISESSID=$sid");
-        exit;
+        $alias = "admin"; $pass  = $alias; dbSrc('dbi:Pg:host=localhost;');
     }
-    ##From here we have data source set, currently Progress DB SQL and SQLite SQL compatible.
-    dbSrc($sss->param('db_source'));
     my $ret  = connectDB($alias, $pass);
     getConfiguration($ret);
     
@@ -241,7 +243,7 @@ if($IS_PG_DB){
         ID_CAT INT        NOT NULL,
         ID_RTF INTEGER    DEFAULT 0,
         DATE TIMESTAMP    NOT NULL,
-        LOG VARCHAR (128) NOT NULL,
+        LOG VARCHAR (1024) NOT NULL,
         AMOUNT INTEGER,
         AFLAG INT         DEFAULT 0,
         STICKY BOOL       DEFAULT FALSE,
@@ -479,6 +481,7 @@ sub printDebugHTML {
 
 sub toLog {
     my ($db,$log,$cat) = @_;
+    if(!$db){SettingsException->throw("Database handle not passed!")}
     my $stamp = getCurrentSQLTimeStamp();
         if(!$cat){
             my @arr = selectRecords($db,"SELECT ID FROM CAT WHERE NAME LIKE 'System Log' or NAME LIKE 'System';")->fetchrow_array();