mopve opening DBs into routines so that caching is avoided

This commit is contained in:
Brian Read 2024-11-27 20:11:31 +00:00
parent 1c275912e3
commit 1676739b17
2 changed files with 22 additions and 7 deletions

View File

@ -331,7 +331,7 @@ sub do_display {
# the value of trt will tell you which panel has returned # the value of trt will tell you which panel has returned
if (! $trt){ if (! $trt){
my $trt = $c->param('trt') || 'LIST'; #Indicates where to go now $trt = $c->param('trt') || 'LIST'; #Indicates where to go now
} }
# Now add in the params from the selected row from the table # Now add in the params from the selected row from the table

View File

@ -43,12 +43,6 @@ use esmith::HostsDB;
use esmith::DomainsDB; use esmith::DomainsDB;
#The most common ones
our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
require '/usr/share/smanager/lib/SrvMngr/Controller/${PackageName}-Custom.pm'; #The code that is to be added by the developer require '/usr/share/smanager/lib/SrvMngr/Controller/${PackageName}-Custom.pm'; #The code that is to be added by the developer
@ -67,6 +61,13 @@ sub main {
my $c = shift; my $c = shift;
$c->app->log->info( $c->log_req ); $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");
$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");
my %${prefix}_data = (); my %${prefix}_data = ();
my $title = $c->l('${prefix}_${MenuDescription}'); my $title = $c->l('${prefix}_${MenuDescription}');
my $modul = ''; my $modul = '';
@ -131,6 +132,13 @@ sub do_update {
$c->app->log->info($c->log_req); $c->app->log->info($c->log_req);
my $modul = ''; my $modul = '';
#The most common ones
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
$adb = esmith::AccountsDB->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");
my %${prefix}_data = (); my %${prefix}_data = ();
my $title = $c->l('${prefix}_${MenuDescription}'); my $title = $c->l('${prefix}_${MenuDescription}');
@ -221,6 +229,13 @@ sub do_display {
my ($c,$trt) = @_; my ($c,$trt) = @_;
$c->app->log->info($c->log_req); $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");
$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");
my %${prefix}_data = (); my %${prefix}_data = ();
my $title = $c->l('${prefix}_${MenuDescription}'); my $title = $c->l('${prefix}_${MenuDescription}');
my $modul = ""; my $modul = "";