diff --git a/C4/Auth.pm b/C4/Auth.pm index 04584a9..9295b58 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -31,7 +31,6 @@ use C4::Templates; # to get the template use C4::Languages; use C4::Search::History; use Koha; -use Koha::Caches; use Koha::AuthUtils qw(get_script_name hash_password); use Koha::DateUtils qw(dt_from_string); use Koha::Library::Groups; @@ -1734,9 +1733,10 @@ sub _get_session_params { my $dbh = C4::Context->dbh; return { dsn => "driver:PostgreSQL;serializer:yaml;id:md5", dsn_args => { Handle => $dbh } }; } - elsif ( $storage_method eq 'memcached' && Koha::Caches->get_instance->memcached_cache ) { - my $memcached = Koha::Caches->get_instance()->memcached_cache; - return { dsn => "driver:memcached;serializer:yaml;id:md5", dsn_args => { Memcached => $memcached } }; + elsif ( $storage_method eq 'memcached' ) { + if ( my $memcached = C4::Context->cache->memcached_cache ) { + return { dsn => "driver:memcached;serializer:yaml;id:md5", dsn_args => { Memcached => $memcached } }; + } } else { # catch all defaults to tmp should work on all systems diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index bbb1094..bb21ad1 100644 --- a/C4/Auth_with_ldap.pm +++ b/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'); diff --git a/C4/Biblio.pm b/C4/Biblio.pm index eaff256..16a4b23 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -38,8 +38,8 @@ use C4::Charset; use C4::Linker; use C4::OAI::Sets; use C4::Debug; +use C4::Context; -use Koha::Caches; use Koha::Authority::Types; use Koha::Acquisition::Currencies; use Koha::Biblio::Metadata; @@ -899,7 +899,7 @@ sub GetMarcStructure { $forlibrarian = $forlibrarian ? 1 : 0; my $unsafe = ($params && $params->{unsafe})? 1: 0; - my $cache = Koha::Caches->get_instance(); + my $cache = C4::Context->cache; my $cache_key = "MarcStructure-$forlibrarian-$frameworkcode"; my $cached = $cache->get_from_cache($cache_key, { unsafe => $unsafe }); return $cached if $cached; @@ -1009,7 +1009,7 @@ sub GetMarcSubfieldStructure { $frameworkcode //= ''; - my $cache = Koha::Caches->get_instance(); + my $cache = C4::Context->cache; my $cache_key = "MarcSubfieldStructure-$frameworkcode"; my $cached = $cache->get_from_cache($cache_key); return $cached if $cached; diff --git a/C4/Calendar.pm b/C4/Calendar.pm index 321aad7..42fe20b 100644 --- a/C4/Calendar.pm +++ b/C4/Calendar.pm @@ -23,7 +23,6 @@ use Carp; use Date::Calc qw( Date_to_Days Today); use C4::Context; -use Koha::Caches; use constant ISO_DATE_FORMAT => "%04d-%02d-%02d"; @@ -276,7 +275,7 @@ sub insert_single_holiday { # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Caches->get_instance(); + my $cache = C4::Context->cache; $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -321,7 +320,7 @@ sub insert_exception_holiday { $self->{'exception_holidays'}->{"$options{year}/$options{month}/$options{day}"}{description} = $options{description}; # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Caches->get_instance(); + my $cache = C4::Context->cache; $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -422,7 +421,7 @@ UPDATE special_holidays SET title = ?, description = ? $self->{'single_holidays'}->{"$options{year}/$options{month}/$options{day}"}{description} = $options{description}; # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Caches->get_instance(); + my $cache = C4::Context->cache; $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -465,7 +464,7 @@ UPDATE special_holidays SET title = ?, description = ? $self->{'exception_holidays'}->{"$options{year}/$options{month}/$options{day}"}{description} = $options{description}; # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Caches->get_instance(); + my $cache = C4::Context->cache; $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -546,7 +545,7 @@ sub delete_holiday { } # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Caches->get_instance(); + my $cache = C4::Context->cache; $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -577,7 +576,7 @@ sub delete_holiday_range { $sth->execute($self->{branchcode}, $options{day}, $options{month}, $options{year}); # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Caches->get_instance(); + my $cache = C4::Context->cache; $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -631,7 +630,7 @@ sub delete_exception_holiday_range { $sth->execute($self->{branchcode}, $options{day}, $options{month}, $options{year}); # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Caches->get_instance(); + my $cache = C4::Context->cache; $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; } diff --git a/C4/Context.pm b/C4/Context.pm index 7ce91b6..2dba0ee 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -32,7 +32,7 @@ BEGIN { eval {C4::Context->dbh();}; if ($@){ $debug_level = 1; - } + } else { $debug_level = C4::Context->preference("DebugLevel"); } @@ -50,7 +50,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} |
---|