Lines 58-63
sub _new_schema {
Link Here
|
58 |
my $db_port = $context->config("port") || ''; |
58 |
my $db_port = $context->config("port") || ''; |
59 |
my $db_user = $context->config("user"); |
59 |
my $db_user = $context->config("user"); |
60 |
my $db_passwd = $context->config("pass"); |
60 |
my $db_passwd = $context->config("pass"); |
|
|
61 |
my $db_socket = $context->config("socket") || ''; |
61 |
my $tls = $context->config("tls"); |
62 |
my $tls = $context->config("tls"); |
62 |
my $tls_options; |
63 |
my $tls_options; |
63 |
if( $tls && $tls eq 'yes' ) { |
64 |
if( $tls && $tls eq 'yes' ) { |
Lines 80-88
sub _new_schema {
Link Here
|
80 |
$encoding_query = "set client_encoding = 'UTF8';"; |
81 |
$encoding_query = "set client_encoding = 'UTF8';"; |
81 |
$tz_query = qq(SET TIME ZONE = "$tz") if $tz; |
82 |
$tz_query = qq(SET TIME ZONE = "$tz") if $tz; |
82 |
} |
83 |
} |
|
|
84 |
|
85 |
#Build the dsn, it is typically like |
86 |
# dbi:mysql:database=koha;host=localhost;port=3306 |
87 |
# dbi:mysql:database=koha;mysql_socket=/var/run/mysql/mysql.sock |
88 |
# dbi:Pg:database=koha;host=/var/run/Pg |
89 |
my $dsn = "dbi:$db_driver:database=$db_name;"; |
90 |
#Figure out if we are using sockets and for which DBRMS? |
91 |
if ($db_socket) { |
92 |
if ($db_driver eq 'Pg') { |
93 |
$dsn .= "host=$db_socket;port=$db_port"; #https://www.postgresql.org/docs/9.2/static/libpq-connect.html#LIBPQ-CONNECT-HOST |
94 |
} |
95 |
else { #default to mysql |
96 |
$dsn .= "mysql_socket=$db_socket"; |
97 |
} |
98 |
} |
99 |
else { |
100 |
$dsn .= "host=$db_host;port=$db_port"; |
101 |
} |
102 |
|
83 |
my $schema = Koha::Schema->connect( |
103 |
my $schema = Koha::Schema->connect( |
84 |
{ |
104 |
{ |
85 |
dsn => "dbi:$db_driver:database=$db_name;host=$db_host;port=$db_port".($tls_options? $tls_options : ""), |
105 |
dsn => $dsn.($tls_options? $tls_options : ""), |
86 |
user => $db_user, |
106 |
user => $db_user, |
87 |
password => $db_passwd, |
107 |
password => $db_passwd, |
88 |
%encoding_attr, |
108 |
%encoding_attr, |