|
Lines 45-61
__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 |
my $schema = Koha::Schema->connect( |
| 57 |
"DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port", |
| 58 |
$db_user, $db_passwd ); |
| 59 |
return $schema; |
49 |
return $schema; |
| 60 |
} |
50 |
} |
| 61 |
|
51 |
|