From 79187ab76eae8916aa04fb1b388ac92a021d2b00 Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Thu, 16 Mar 2017 20:59:35 +0200 Subject: [PATCH] Bug 18285 - Koha::Database schema cache accessors Safe way of getting and flushing the $database->{schema} -cache. This is needed by Test::DBIx::Class to overcome pre-initialization connection caching from C4::Context and others. See Buug 18286 --- Koha/Database.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Koha/Database.pm b/Koha/Database.pm index df259c5..7daf5f0 100644 --- a/Koha/Database.pm +++ b/Koha/Database.pm @@ -215,6 +215,23 @@ sub restore_schema { # return something, then this function should, too. } +=head2 get_schema_cached + +=cut + +sub get_schema_cached { + return $database->{schema}; +} + +=head2 flush_schema_cache + +=cut + +sub flush_schema_cache { + delete $database->{schema}; + return 1; +} + =head2 EXPORT None by default. -- 2.7.4