Bug 31180 - Create an audit and/or fixup script for koha-conf.xml
Summary: Create an audit and/or fixup script for koha-conf.xml
Status: REOPENED
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-18 19:44 UTC by Manos PETRIDIS
Modified: 2024-12-01 19:47 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Manos PETRIDIS 2022-07-18 19:44:35 UTC
I feel that a checker should be provided that checks the various configuration files -koha-conf.xml is a prime suspect- and notify the library admin of missing stanzas or invalid values. For example, missing information on fonts to be used, or reference to non-existent (or non-accessible) files and/or folders.
Comment 1 Katrin Fischer 2022-07-18 19:46:58 UTC
We already have some checks in place and the results show on the system information tab on the About Koha page.

The fonts section missing could be another to add. Maybe we could change this bug report to cover that.
Comment 2 David Cook 2023-01-18 03:41:05 UTC
Closing this one for now since it's too broad. Feel free to re-open and re-name
Comment 3 David Cook 2024-10-30 23:36:31 UTC
Like bug 34064, it could be good to have an audit script that compares the current koha-conf.xml against an authoritative version.

Comparing the koha-conf.xml file is significantly harder to comparing the database and kohastructure.sql, but it's not impossible. 

The "authoritative version" we have is a template which contains a lot of placeholders for values, so directly comparing vlaues could be tricky.

Analyzing values in a meaningful way would also require a lot more work.

But... missing keys are quite easy to find.
Comment 4 David Cook 2024-10-30 23:42:28 UTC
Locally, for a few years, when a new version of Koha comes out, I create/refactor a script called something like "fixup_kohaconf_2311.pl", which compares a Koha instance (created via Debian package) against /etc/koha/koha-conf-site.xml.in

I think that I mentioned it previously to Jonathan on bug 28911. In fact, it looks like I shared an example script there.

It's not a very maintainable script by 1 person. If we were to include a fixup script like that... we'd need to change our development process.

But there is a precedent for that.

./etc/koha-conf.xml and ./debian/templates/koha-conf-site.xml.in are comparable to kohastructure.sql

We'd want something like ./installer/data/mysql/updatedatabase.pl but for koha-conf.xml. 

So any dev that added something to koha-conf.xml would need to add an entry into "updateconfig.pl" or equivalent. (Honestly, that could make testing easier for koha-conf.xml changes as well.)
Comment 5 David Cook 2024-10-30 23:47:47 UTC
If we use a fixup script in an automated fashion, we'll need to definitely determine the permissions of the koha-conf.xml file.

As I mentioned on bug 31059, I've noticed in some cases koha-conf.xml owned by the Koha instance and in some cases owned by root. 

This is important because if it's owned by root, it means running "koha-shell kohadev -c "perl updateconfig.pl" isn't going to work.

Maybe we just assume that we need to use root to update the config files, and keep that in mind for a /usr/sbin/koha-upgrade-config script (which would invoke the real updateconfig.pl script in the right context).
Comment 6 David Cook 2024-10-31 00:04:13 UTC
Note one thing about the fixup script I've attached previously on bug 28911

The XML generated by XML::LibXML has slightly different whitespace to what we have. I'd love to change the whitespace in our template files to align with the output of XML::LibXML to make it easier to do diffs using "vimdiff" for instance.