File reload_config.patch of Package ZoneMinder

From b215b50dabd2595f218f22b454666443c80941ae Mon Sep 17 00:00:00 2001
From: Dirk Hartmann <2monex@gmx.net>
Date: Thu, 3 Apr 2014 20:13:44 +0200
Subject: [PATCH 4/7] reload_config.patch

---
 scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in | 12 ++++++++----
 scripts/zmpkg.pl.in                            |  3 +++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in
index ead35c525..926856aca 100644
--- a/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in
+++ b/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in
@@ -72,9 +72,8 @@ use Carp;
 require ZoneMinder::Database;
 
 # Load the config from the database into the symbol table
-BEGIN {
-require ZoneMinder::Database;
-
+sub load_configuration
+{
   # Process name, value pairs from the main config file first
   my $config_file = ZM_CONFIG;
   process_configfile($config_file);
@@ -144,7 +143,7 @@ require ZoneMinder::Database;
     close($CONFIG);
   } # end sub process_configfile
 
-} # end BEGIN
+} # end load_configuration
 
 sub loadConfigFromDB {
   print( 'Loading config from DB' );
@@ -248,6 +247,11 @@ sub saveConfigToDB {
   $dbh->{AutoCommit} = $ac;
 } # end sub saveConfigToDB
 
+BEGIN
+{
+       require ZoneMinder::Database;
+       load_configuration(); 
+} # end BEGIN
 1;
 __END__
 
diff --git a/scripts/zmpkg.pl.in b/scripts/zmpkg.pl.in
index 94e9c9bfc..fe74704fd 100644
--- a/scripts/zmpkg.pl.in
+++ b/scripts/zmpkg.pl.in
@@ -175,6 +175,9 @@ if ( $command =~ /^(?:start|restart)$/ ) {
   Debug("zmdc.pl check = $status");
 
   if ( $status eq 'stopped' ) {
+  
+    ZoneMinder::Config::load_configuration();
+    
     if ( $Config{ZM_DYN_DB_VERSION}
         and ( $Config{ZM_DYN_DB_VERSION} ne ZM_VERSION )
        ) {
-- 
2.26.0
openSUSE Build Service is sponsored by