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

(-)a/Koha/Database.pm (-15 / +1 lines)
Lines 45-65 __PACKAGE__->mk_accessors(qw( )); Link Here
45
# database connection from the data given in the current context, and
45
# database connection from the data given in the current context, and
46
# returns it.
46
# returns it.
47
sub _new_schema {
47
sub _new_schema {
48
    my $context = C4::Context->new();
48
    my $schema = Koha::Schema->connect( sub { C4::Context->dbh } );
49
    my $db_driver = C4::Context::db_scheme2dbi($context->config("db_scheme"));
50
51
    my $db_name   = $context->config("database");
52
    my $db_host   = $context->config("hostname");
53
    my $db_port   = $context->config("port") || '';
54
    my $db_user   = $context->config("user");
55
    my $db_passwd = $context->config("pass");
56
57
    my $db_opts = ($db_driver eq 'mysql') ? { mysql_enable_utf8 => 1 } :
58
                  ($db_driver eq 'Pg')    ? { pg_enable_utf8    => 1 } :
59
                                            { };
60
    my $schema    = Koha::Schema->connect(
61
        "DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",
62
        $db_user, $db_passwd, $db_opts );
63
    return $schema;
49
    return $schema;
64
}
50
}
65
51
(-)a/Koha/Schema.pm (-1 / +1 lines)
Lines 15-20 __PACKAGE__->load_namespaces; Link Here
15
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
15
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
16
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oDUxXckmfk6H9YCjW8PZTw
16
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oDUxXckmfk6H9YCjW8PZTw
17
17
18
__PACKAGE__->storage_type('Koha::Storage');
18
19
19
# You can replace this text with custom content, and it will be preserved on regeneration
20
1;
20
1;
(-)a/Koha/Storage.pm (-1 / +16 lines)
Line 0 Link Here
0
- 
1
use utf8;
2
package Koha::Storage;
3
4
use strict;
5
use warnings;
6
7
use base 'DBIx::Class::Storage::DBI';
8
sub DESTROY {
9
    my $self = shift;
10
11
    # destroy just the object if not native to this process/thread
12
    $self->_preserve_foreign_dbh;
13
14
    $self->_dbh(undef);
15
}
16
1;

Return to bug 11891