Lines 73-101
sub new {
Link Here
|
73 |
|
73 |
|
74 |
my $self = {}; |
74 |
my $self = {}; |
75 |
|
75 |
|
76 |
# get basic information from context |
76 |
$self->{'dbh'} = C4::Context->dbh(); |
77 |
$self->{'dbname'} = C4::Context->config("database"); |
|
|
78 |
$self->{'dbms'} = C4::Context->config("db_scheme") ? C4::Context->config("db_scheme") : "mysql"; |
79 |
$self->{'hostname'} = C4::Context->config("hostname"); |
80 |
$self->{'port'} = C4::Context->config("port"); |
81 |
$self->{'user'} = C4::Context->config("user"); |
82 |
$self->{'password'} = C4::Context->config("pass"); |
83 |
$self->{'tls'} = C4::Context->config("tls"); |
84 |
if( $self->{'tls'} && $self->{'tls'} eq 'yes' ) { |
85 |
$self->{'ca'} = C4::Context->config('ca'); |
86 |
$self->{'cert'} = C4::Context->config('cert'); |
87 |
$self->{'key'} = C4::Context->config('key'); |
88 |
$self->{'tlsoptions'} = ";mysql_ssl=1;mysql_ssl_client_key=".$self->{key}.";mysql_ssl_client_cert=".$self->{cert}.";mysql_ssl_ca_file=".$self->{ca}; |
89 |
$self->{'tlscmdline'} = " --ssl-cert ". $self->{cert} . " --ssl-key " . $self->{key} . " --ssl-ca ".$self->{ca}." " |
90 |
} |
91 |
$self->{'dbh'} = DBI->connect("DBI:$self->{dbms}:dbname=$self->{dbname};host=$self->{hostname}" . |
92 |
( $self->{port} ? ";port=$self->{port}" : "" ). |
93 |
( $self->{tlsoptions} ? $self->{tlsoptions} : ""), |
94 |
$self->{'user'}, $self->{'password'}); |
95 |
$self->{'language'} = undef; |
77 |
$self->{'language'} = undef; |
96 |
$self->{'marcflavour'} = undef; |
78 |
$self->{'marcflavour'} = undef; |
97 |
$self->{'dbh'}->do('set NAMES "utf8"'); |
|
|
98 |
$self->{'dbh'}->{'mysql_enable_utf8'}=1; |
99 |
|
79 |
|
100 |
bless $self, $class; |
80 |
bless $self, $class; |
101 |
return $self; |
81 |
return $self; |
102 |
- |
|
|