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 <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Olli-Antti Kivilahti 2017-03-16 20:59:35 +02:00 committed by Jonathan Druart
parent dd9da3e8f6
commit 149d8a6ec2
1 changed files with 17 additions and 0 deletions

View File

@ -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.