Merge branch 'merge_db_connects' into storageareas

This commit is contained in:
Isaac Connor 2016-05-07 09:35:14 -04:00
commit e064af4214
2 changed files with 9 additions and 15 deletions

View File

@ -81,12 +81,6 @@ our @EXPORT = ( @EXPORT_OK );
our $VERSION = $ZoneMinder::Base::VERSION;
BEGIN {
require ZoneMinder::Config;
require ZoneMinder::Database;
ZoneMinder::Config::zmConfigLoad();
ZoneMinder::Database::zmDbConnect();
}
1;
__END__

View File

@ -31,6 +31,7 @@ use DBI;
require Exporter;
require ZoneMinder::Base;
require ZoneMinder::Config;
our @ISA = qw(Exporter ZoneMinder::Base);
@ -65,7 +66,6 @@ our $VERSION = $ZoneMinder::Base::VERSION;
# ==========================================================================
use ZoneMinder::Logger qw(:all);
use ZoneMinder::Config qw(:all);
use Carp;
@ -80,23 +80,23 @@ sub zmDbConnect
}
if ( !defined( $dbh ) )
{
my ( $host, $port ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ );
my ( $host, $port ) = ( $ZoneMinder::Config::Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ );
if ( defined($port) )
{
$dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}
$dbh = DBI->connect( "DBI:mysql:database=".$ZoneMinder::Config::Config{ZM_DB_NAME}
.";host=".$host
.";port=".$port
, $Config{ZM_DB_USER}
, $Config{ZM_DB_PASS}
, $ZoneMinder::Config::Config{ZM_DB_USER}
, $ZoneMinder::Config::Config{ZM_DB_PASS}
);
}
else
{
$dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}
.";host=".$Config{ZM_DB_HOST}
, $Config{ZM_DB_USER}
, $Config{ZM_DB_PASS}
$dbh = DBI->connect( "DBI:mysql:database=".$ZoneMinder::Config::Config{ZM_DB_NAME}
.";host=".$ZoneMinder::Config::Config{ZM_DB_HOST}
, $ZoneMinder::Config::Config{ZM_DB_USER}
, $ZoneMinder::Config::Config{ZM_DB_PASS}
);
}
$dbh->trace( 0 );