From dca0b9c33d55aa22891364806d09f0c8af55ef0c Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 16 Jul 2025 16:59:07 +0200 Subject: [PATCH] Bug 39740: Add is_test_system to koha-functions, incorporate in koha-plack Content-Type: text/plain; charset=utf-8 Result of is_test_system will be determined by looking at KTD_HOME and TEST_SYSTEM in the environment. If is_test_system returns true or the flag --development (introduced on bug 36932) is set when calling koha-plack, koha-plack allows dumping a stack trace. Test plan: Copy koha-plack to /usr/sbin, and koha-functions.sh to /usr/share/koha/bin. Source bin/koha-functions.sh ('. bin/koha-functions.sh') Play with values of KTD_HOME and TEST_SYSTEM and look at results of: if is_test_system; then echo 'Test system'; fi Add a die in e.g. opac/opac-main.pl causing a 500. Do you see a stack trace and is that expected? It will be in KTD, otherwise you need to make sure that TEST_SYSTEM=1 is exported in your environment. Signed-off-by: Marcel de Rooy --- debian/scripts/koha-functions.sh | 8 ++++++++ debian/scripts/koha-plack | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/debian/scripts/koha-functions.sh b/debian/scripts/koha-functions.sh index 90ccf1611e..0322163327 100755 --- a/debian/scripts/koha-functions.sh +++ b/debian/scripts/koha-functions.sh @@ -386,6 +386,14 @@ adjust_paths_dev_install() fi } +is_test_system() +{ + if [ -n "$KTD_HOME" ]; then return 0; #true + elif [ -n "$TEST_SYSTEM" ]; then return 0; + else return 1; # false + fi +} + get_instances() { find -L /etc/koha/sites -mindepth 1 -maxdepth 1\ diff --git a/debian/scripts/koha-plack b/debian/scripts/koha-plack index eb3282c0f5..8b58fc077b 100755 --- a/debian/scripts/koha-plack +++ b/debian/scripts/koha-plack @@ -92,7 +92,11 @@ start_plack() instance_user="${instancename}-koha" - if [ -z "$development_environment" ]; then environment="deployment"; else environment="development"; fi + if is_test_system || [ -n "$development_environment" ]; then + environment="development" + else + environment="deployment" + fi daemonize="--daemonize" logging="--access-log /var/log/koha/${instancename}/plack.log \ --error-log /var/log/koha/${instancename}/plack-error.log" -- 2.39.5