mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-27 16:58:31 -04:00
Reapply changes to Database.pm
This commit is contained in:
1 parent
2ab79820a1
commit
38e1cc909c
1 file changed
+17
-13
@@ -79,25 +79,29 @@ sub zmDbConnect
|
||||
}
|
||||
if ( !defined( $dbh ) )
|
||||
{
|
||||
my ( $host, $port ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ );
|
||||
my $socket;
|
||||
my ( $host, $portOrSocket ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ );
|
||||
|
||||
if ( defined($port) )
|
||||
if ( defined($portOrSocket) )
|
||||
{
|
||||
$dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}
|
||||
.";host=".$host
|
||||
.";port=".$port
|
||||
, $Config{ZM_DB_USER}
|
||||
, $Config{ZM_DB_PASS}
|
||||
);
|
||||
if ( $portOrSocket =~ /^\// )
|
||||
{
|
||||
$socket = ";mysql_socket=".$portOrSocket;
|
||||
}
|
||||
else
|
||||
{
|
||||
$socket = ";host=".$host.";port=".$portOrSocket;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}
|
||||
.";host=".$Config{ZM_DB_HOST}
|
||||
, $Config{ZM_DB_USER}
|
||||
, $Config{ZM_DB_PASS}
|
||||
);
|
||||
$socket = ";host=".$Config{ZM_DB_HOST};
|
||||
}
|
||||
$dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}
|
||||
.$socket
|
||||
, $Config{ZM_DB_USER}
|
||||
, $Config{ZM_DB_PASS}
|
||||
);
|
||||
$dbh->trace( 0 );
|
||||
}
|
||||
return( $dbh );
|
||||
|
||||
Reference in new issue
Block a user