Bug 11921: Update remaining occurrences of ->ismemcached
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 23 Jun 2016 05:33:23 +0000 (06:33 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Thu, 8 Sep 2016 10:28:59 +0000 (10:28 +0000)
TODO: Would be better to provide a better way to know if memcache is correctly set
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

C4/Auth.pm
Koha/Cache.pm
reports/guided_reports.pl

index 17e2cc1..1bbe978 100644 (file)
@@ -32,6 +32,7 @@ use C4::Languages;
 use C4::Branch;       # GetBranches
 use C4::Search::History;
 use Koha;
+use Koha::Caches;
 use Koha::AuthUtils qw(get_script_name hash_password);
 use Koha::LibraryCategories;
 use Koha::Libraries;
@@ -1727,7 +1728,7 @@ sub get_session {
     elsif ( $storage_method eq 'Pg' ) {
         $session = new CGI::Session( "driver:PostgreSQL;serializer:yaml;id:md5", $sessionID, { Handle => $dbh } );
     }
-    elsif ( $storage_method eq 'memcached' && C4::Context->ismemcached ) {
+    elsif ( $storage_method eq 'memcached' && Koha::Caches->get_instance->memcached_cache ) {
         $session = new CGI::Session( "driver:memcached;serializer:yaml;id:md5", $sessionID, { Memcached => C4::Context->memcached } );
     }
     else {
index eda115e..be12512 100644 (file)
@@ -88,7 +88,7 @@ sub new {
     unless ( $self->{namespace} and @servers ) {
         my $koha_config = Koha::Config->read_from_file( Koha::Config->guess_koha_conf() );
         $self->{namespace} ||= $koha_config->{config}{memcached_namespace} || 'koha';
-        @servers ||= split /,/, $koha_config->{config}{memcached_servers};
+        @servers = split /,/, $koha_config->{config}{memcached_servers} unless @servers;
     }
     $self->{namespace} .= ":$subnamespace:";
 
index a825707..8e95556 100755 (executable)
@@ -31,6 +31,7 @@ use C4::Debug;
 use C4::Koha qw/GetFrameworksLoop/;
 use C4::Branch;
 use C4::Context;
+use Koha::Caches;
 use C4::Log;
 use Koha::DateUtils qw/dt_from_string output_pref/;
 use Koha::AuthorisedValue;
@@ -47,7 +48,7 @@ Script to control the guided report creation
 =cut
 
 my $input = new CGI;
-my $usecache = C4::Context->ismemcached;
+my $usecache = Koha::Caches->get_instance->memcached_cache;
 
 my $phase = $input->param('phase') // '';
 my $flagsrequired;