Bug 14339: C4::Context->preference should return undef if DB is not populated
authorTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 5 Jun 2015 13:56:56 +0000 (10:56 -0300)
committerTomas Cohen Arazi <tomascohen@theke.io>
Sun, 7 Jun 2015 21:38:09 +0000 (18:38 -0300)
commitc671784321b1ebcf9aca18c061ec30bed3e89a58
tree9dc524ec649f32d0eb95f8f6200fd25de5ae3a26
parent3ef7bfc6cf5b43784a9edc212a4bfc07b1d34b35
Bug 14339: C4::Context->preference should return undef if DB is not populated

The current behaviour for C4::Context->preference when the DB is not still
populated with tables is to return undef. This is used by C4::Auth to identify
the need of running the installer.

This behaviour got broken by bug 13967, which lets DB errors to escalate and
thus Koha gets broken instead of prompting for install.

This patch wraps Koha::Config::Sysprefs->find inside an eval and sets undef if needed.

To test:
- In current master, drop the DB
- Load OPAC and Intranet
=> FAIL: notice an ugly software error.
- Apply the patch
- Load the OPAC
=> SUCCESS: Maintenance mode screen is shown
- Load Intranet
=> SUCCESS: You are prompted the DB credentials to run the web installer.
- Sign off :-D

Tomas

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
C4/Context.pm