From 93395e10d963b6b2a0d2c88f968f2e79b9448f95 Mon Sep 17 00:00:00 2001 From: Brian Read Date: Mon, 6 Oct 2025 10:59:27 +0100 Subject: [PATCH] * Mon Oct 06 2025 Brian Read 11.1-13.sme - Add UTF8 and avoid potential DB caching problems [SME: 13209] --- .../SrvMngr/Controller/Mailstats-Custom.pm | 12 +++---- .../lib/SrvMngr/Controller/Mailstats.pm | 36 +++++++++---------- smeserver-mailstats.spec | 5 ++- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/root/usr/share/smanager/lib/SrvMngr/Controller/Mailstats-Custom.pm b/root/usr/share/smanager/lib/SrvMngr/Controller/Mailstats-Custom.pm index 5afb4b9..b9cf43a 100644 --- a/root/usr/share/smanager/lib/SrvMngr/Controller/Mailstats-Custom.pm +++ b/root/usr/share/smanager/lib/SrvMngr/Controller/Mailstats-Custom.pm @@ -7,11 +7,11 @@ # use esmith::util; use esmith::util::network; -use esmith::ConfigDB; -use esmith::HostsDB; -use esmith::AccountsDB; +use esmith::ConfigDB::UTF8; +use esmith::HostsDB::UTF8; +use esmith::AccountsDB::UTF8; use esmith::NetworksDB; -use esmith::DomainsDB; +use esmith::DomainsDB::UTF8; use POSIX 'strftime'; @@ -96,7 +96,7 @@ use constant TRUE => 1; sub get_data_for_panel_CONFIG { # Return a hash with the fields required which will be loaded into the shared data my $c = shift; - my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); + my $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db"); my $key = 'mailstats'; my %ret = ( 'Data1'=>'Data for CONFIG', #Example @@ -171,7 +171,7 @@ use constant TRUE => 1; my $c = shift; my $prefix_data = shift; #Data hash as parameter my $ret = ""; - my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); + my $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db"); my $db = $cdb; #maybe one of the others my $dbkey = 'mailstats'; # To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g." diff --git a/root/usr/share/smanager/lib/SrvMngr/Controller/Mailstats.pm b/root/usr/share/smanager/lib/SrvMngr/Controller/Mailstats.pm index acf8548..eeaa841 100644 --- a/root/usr/share/smanager/lib/SrvMngr/Controller/Mailstats.pm +++ b/root/usr/share/smanager/lib/SrvMngr/Controller/Mailstats.pm @@ -36,11 +36,11 @@ use Data::Dumper; use esmith::util; use esmith::util::network; -use esmith::ConfigDB; -use esmith::AccountsDB; +use esmith::ConfigDB::UTF8; +use esmith::AccountsDB::UTF8; use esmith::NetworksDB; -use esmith::HostsDB; -use esmith::DomainsDB; +use esmith::HostsDB::UTF8; +use esmith::DomainsDB::UTF8; my $cdb; my $adb; @@ -66,11 +66,11 @@ sub main { $c->app->log->info( $c->log_req ); #The most common ones - $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); - $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); + $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db"); + $adb = esmith::AccountsDB::UTF8->open() || die("Couldn't open Accounts db"); $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); - $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); - $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); + $hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db"); + $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db"); my %mst_data = (); my $title = $c->l('mst_Mailstats'); @@ -118,11 +118,11 @@ sub do_update { my $modul = ''; #The most common ones - you might want to comment out any not used. - $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); - $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); + $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db"); + $adb = esmith::AccountsDB::UTF8->open() || die("Couldn't open Accounts db"); $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); - $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); - $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); + $hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db"); + $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db"); my %mst_data = (); my $title = $c->l('mst_Mailstats'); @@ -225,18 +225,18 @@ sub do_display { $c->app->log->info($c->log_req); #The most common ones - you might want to comment out any not used. - $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); - $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); + $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db"); + $adb = esmith::AccountsDB::UTF8->open() || die("Couldn't open Accounts db"); $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); - $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); - $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); + $hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db"); + $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db"); my %mst_data = (); my $title = $c->l('mst_Mailstats'); my $modul = ""; # Accessing all parameters - my %params = $c->req->params->to_hash; + my %params = %{ $c->req->params->to_hash }; # Get number of parameters my $num_params = keys %params; @@ -312,4 +312,4 @@ sub do_display { ); $c->render(template => "mailstats"); } -1; +1; \ No newline at end of file diff --git a/smeserver-mailstats.spec b/smeserver-mailstats.spec index 501e65c..7bb58cd 100644 --- a/smeserver-mailstats.spec +++ b/smeserver-mailstats.spec @@ -6,7 +6,7 @@ Summary: Daily mail statistics for SME Server %define name smeserver-mailstats Name: %{name} %define version 11.1 -%define release 12 +%define release 13 %define full_version %{version}.%{release}) Version: %{version} Release: %{release}%{?dist} @@ -88,6 +88,9 @@ chmod u+s /usr/bin/journalwrap /sbin/ldconfig %changelog +* Mon Oct 06 2025 Brian Read 11.1-13.sme +- Add UTF8 and avoid potential DB caching problems [SME: 13209] + * Tue Sep 30 2025 Brian Read 11.1-12.sme - Fix httpd conf fragment and add in ValidFrom Ips [SME: 13204]