@@ -, +, @@ If you want current context, call C4::Context->current(). C4::Context->some_method() will still work as is. database set_schema() and restore_schema(). Created run_within_context() that wraps set_context() and restore_context() around code. different (database) contexts. will correct that. --- C4/Auth_with_cas.pm | 2 +- C4/Auth_with_ldap.pm | 2 +- C4/Context.pm | 306 +++++++++++------------- Koha/Database.pm | 38 ++- Koha/Handler/Plack.pm | 163 +++++++++++++ Koha/Handler/Plack/CGI.pm | 228 ++++++++++++++++++ admin/systempreferences.pl | 2 +- misc/plack/koha-multi.psgi | 29 +++ misc/translator/LangInstaller.pm | 2 +- t/Context.t | 25 ++ t/Koha_Handler_Plack.t | 136 +++++++++++ t/conf/dummy/koha-conf.xml | 7 + t/conf/koha1/koha-conf.xml | 7 + t/conf/koha2/koha-conf.xml | 5 + t/db_dependent/Amazon.t | 2 +- t/db_dependent/Context.t | 2 +- t/db_dependent/Koha_template_plugin_KohaDates.t | 2 +- t/db_dependent/XISBN.t | 2 +- t/db_dependent/sysprefs.t | 5 +- 19 files changed, 782 insertions(+), 183 deletions(-) create mode 100644 Koha/Handler/Plack.pm create mode 100644 Koha/Handler/Plack/CGI.pm create mode 100644 misc/plack/koha-multi.psgi create mode 100644 t/Koha_Handler_Plack.t create mode 100644 t/conf/dummy/koha-conf.xml create mode 100644 t/conf/koha1/koha-conf.xml create mode 100644 t/conf/koha2/koha-conf.xml --- a/C4/Auth_with_cas.pm +++ a/C4/Auth_with_cas.pm @@ -37,7 +37,7 @@ BEGIN { @ISA = qw(Exporter); @EXPORT = qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url); } -my $context = C4::Context->new() or die 'C4::Context->new failed'; +my $context = C4::Context->current() or die 'No current context'; my $defaultcasserver; my $casservers; my $yamlauthfile = C4::Context->config('intranetdir') . "/C4/Auth_cas_servers.yaml"; --- a/C4/Auth_with_ldap.pm +++ a/C4/Auth_with_ldap.pm @@ -54,7 +54,7 @@ sub ldapserver_error { } use vars qw($mapping @ldaphosts $base $ldapname $ldappassword); -my $context = C4::Context->new() or die 'C4::Context->new failed'; +my $context = C4::Context->current() or die 'No current context'; my $ldap = C4::Context->config("ldapserver") or die 'No "ldapserver" in server hash from KOHA_CONF: ' . $ENV{KOHA_CONF}; my $prefhost = $ldap->{hostname} or die ldapserver_error('hostname'); my $base = $ldap->{base} or die ldapserver_error('base'); --- a/C4/Context.pm +++ a/C4/Context.pm @@ -31,7 +31,7 @@ BEGIN { eval {C4::Context->dbh();}; if ($@){ $debug_level = 1; - } + } else { $debug_level = C4::Context->preference("DebugLevel"); } @@ -49,7 +49,7 @@ BEGIN { # a little example table with various version info"; print "
The following fatal error has occurred:
+The following fatal error has occurred:
$msg
Apache | $versions{apacheVersion} |
---|