Bug 24272: add check_sysprefs_cache.pl
authorNick <nick@bywatersolutions.com>
Thu, 19 Dec 2019 03:20:36 +0000 (03:20 +0000)
committerVictor Grousset/tuxayo <victor@tuxayo.net>
Mon, 1 Feb 2021 23:44:45 +0000 (00:44 +0100)
commit55e24dd56a1bb6d02adab9d1f6792d4741599613
treeb62906dcd67d8a02ec83e48f7dab1bfdf2c07f4d
parent43021f62a528db86426787978952f269d90957f6
Bug 24272: add check_sysprefs_cache.pl

This script ensure that no sysprefs have been changed directly in the database and/or
that the cache has not become corrupted. We have occasionally seen this happen on production sites

To test:
1 - In the staff interface go to Administration
2 - Search for system preference 'IntranetUserJS'
3 - Add content to the syspref:
    console.log('Hi!');
4 - On the command line launch mysql
    sudo koha-mysql kohadev
5 - Alter the syspref directly
    UPDATE systempreferences SET value = "console.log('Bye!');" WHERE variable = 'IntranetUserJS';
6 - run the script
    perl misc/maintenance/check_syspref_cache.pl
7 - You are warned about the altered system preference

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit de5527f37d898e756cac4d8ed9de63c6576c1241)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5a1e18efd87c34ef9f158c4a6f663d30ab3a4e43)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit ff6951e83bd9eeb2bfd2ec4794ce6c8b3e72a33c)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
misc/maintenance/check_syspref_cache.pl [new file with mode: 0755]