From 149d8a6ec2413fc59a8bb51d520adec49b46bbe5 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 Bug 18286. Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- Koha/Database.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Koha/Database.pm b/Koha/Database.pm index df259c5ec4..7daf5f0cac 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.39.5