From b51ffd4eab1533ed1754c162d6cd1abeadff4e4c Mon Sep 17 00:00:00 2001 From: Will Budicm Date: Mon, 26 Oct 2020 07:04:27 +1100 Subject: [PATCH] Report not avail, files size of database if RDBSM. --- htdocs/cgi-bin/stats.cgi | 13 +++++-------- htdocs/cgi-bin/system/modules/Settings.pm | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/htdocs/cgi-bin/stats.cgi b/htdocs/cgi-bin/stats.cgi index 5ea154e..7718bb9 100755 --- a/htdocs/cgi-bin/stats.cgi +++ b/htdocs/cgi-bin/stats.cgi @@ -50,11 +50,6 @@ Settings::dbFile($sss->param('database')); Settings::getConfiguration($db); Settings::getTheme(); ### - -my @stat = stat Settings::dbFile(); -Settings::getConfiguration($db); -Settings::getTheme(); - my $today = DateTime->now; $today->set_time_zone(&Settings::timezone); @@ -141,7 +136,9 @@ my $hardware_status = "Host: $hst
".join("\t", map { defined ? $_ : '' 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 -`; -my $dbSize = (uc format_bytes($stat[7], bs => 1000)); +my @stat = stat Settings::dbFile(); +my $dbSize = "Not Avail"; + $dbSize = (uc format_bytes($stat[7], bs => 1000)) if !Settings::isProgressDB(); #Strip kernel 0 processes reported $processes =~ s/\s*0.00.*//gd; #trim reduce prefixed spacing @@ -152,14 +149,14 @@ my $IPPublic = `curl -s https://www.ifconfig.me`; my $IPPrivate = `hostname -I`; $IPPrivate =~ s/\s/
/g; my $tbl = qq( - + - +
* Personal Log Data Statistics *
LifeLog App. Version:).&Settings::release.qq(
LifeLog App. Version:).Settings::release().qq(
Number of Records:$log_rc
No. of Records This Year:$log_this_year_rc
No. of RTF Documents:$notes_rc
# Sum of Expenses For Year $year$expense
# Sum of Income For Year $year$income
Gross For Year $year$gross
$Settings::DBFILE$dbSize
$dbname$dbSize
Public IP$IPPublic
Private IP$IPPrivate
); diff --git a/htdocs/cgi-bin/system/modules/Settings.pm b/htdocs/cgi-bin/system/modules/Settings.pm index 9ecae9d..6b33eeb 100644 --- a/htdocs/cgi-bin/system/modules/Settings.pm +++ b/htdocs/cgi-bin/system/modules/Settings.pm @@ -39,7 +39,7 @@ our $COMPRESS_ENC = 0; #HTTP Compressed encoding. our $DBI_SOURCE = "DBI:SQLite:"; our $DSN; our $DBFILE; -our $IS_PG_DB=0; +our $IS_PG_DB = 0; #Annons here, variables that could be overiden in code or database, per need. @@ -153,7 +153,7 @@ sub selLogIDCount { } sub selStartOfYear { - if($IS_PG_DB){return "date>= date_trunc('year', now());"} + if($IS_PG_DB){return "date>= date_trunc('year', now())"} return "date>=date('now','start of year')" } -- 2.34.1