Bug 25026: Use HandleError to not raise or print error
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 3 Dec 2020 09:46:31 +0000 (10:46 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 9 Feb 2021 09:20:49 +0000 (10:20 +0100)
commitaa178bcf6a31cc4335fe417c89d85bc94f279667
treec4903f6f9dba5f63e8aac7af96c525f09cc14dbb
parentde14c96249e648c29aecbf759413c3c7ec094d18
Bug 25026: Use HandleError to not raise or print error

DBIC has its own HandleError, and so it does not work to unset
RaiseError or PrintError if unsafe is not set (what we don't want here).

The idea of this patch is to overwrite the HandleError when we need it:
Either if KOHA_DB_DO_NOT_RAISE_OR_PRINT_ERROR is set (misc4dev)
Or if the installer is triggered (we don't want to explode if the DB
does not exist).

There is an additional trick, when the installer is completed, we want
to restore the original behaviour, and so a disconnect is made.
Note that during the installer we want to display eventual SQL errors,
that's why we still display the errors.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Database.pm
installer/install.pl