View | Details | Raw Unified | Return to bug 11974
Collapse All | Expand All

(-)a/Koha/Database.pm (-1 / +21 lines)
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,
(-)a/debian/templates/koha-conf-site.xml.in (+1 lines)
Lines 252-257 __END_SRU_PUBLICSERVER__ Link Here
252
 <database>__DB_NAME__</database>
252
 <database>__DB_NAME__</database>
253
 <hostname>__DB_HOST__</hostname>
253
 <hostname>__DB_HOST__</hostname>
254
 <port>3306</port>
254
 <port>3306</port>
255
 <socket>__DB_SOCKET__</socket> <!-- Set this for custom unix socket connection. In PostgreSQL this is the directory where the socket should be in, not the socket file, like with MariaDB/MySQL -->
255
 <user>__DB_USER__</user>
256
 <user>__DB_USER__</user>
256
 <pass>__DB_PASS__</pass>
257
 <pass>__DB_PASS__</pass>
257
 <biblioserver>biblios</biblioserver>
258
 <biblioserver>biblios</biblioserver>
(-)a/etc/koha-conf.xml (-1 / +1 lines)
Lines 76-81 __PAZPAR2_TOGGLE_XML_POST__ Link Here
76
 <database>__DB_NAME__</database>
76
 <database>__DB_NAME__</database>
77
 <hostname>__DB_HOST__</hostname>
77
 <hostname>__DB_HOST__</hostname>
78
 <port>__DB_PORT__</port>
78
 <port>__DB_PORT__</port>
79
 <socket>__DB_SOCKET__</socket> <!-- Set this for custom unix socket connection. In PostgreSQL this is the directory where the socket should be in, not the socket file, like with MariaDB/MySQL -->
79
 <user>__DB_USER__</user>
80
 <user>__DB_USER__</user>
80
 <pass>__DB_PASS__</pass>
81
 <pass>__DB_PASS__</pass>
81
 <tls>__DB_USE_TLS__</tls>
82
 <tls>__DB_USE_TLS__</tls>
82
- 

Return to bug 11974