Bugzilla – Attachment 115029 Details for
Bug 24272
Add a command line script to compare the syspref cache to the database
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24272: add check_sysprefs_cache.pl
Bug-24272-add-checksysprefscachepl.patch (text/plain), 2.71 KB, created by
Martin Renvoize (ashimema)
on 2021-01-11 13:49:17 UTC
(
hide
)
Description:
Bug 24272: add check_sysprefs_cache.pl
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-01-11 13:49:17 UTC
Size:
2.71 KB
patch
obsolete
>From 205a4736e3126ea075923eed0079744d1e35a885 Mon Sep 17 00:00:00 2001 >From: Nick <nick@bywatersolutions.com> >Date: Thu, 19 Dec 2019 03:20:36 +0000 >Subject: [PATCH] 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> >--- > misc/maintenance/check_syspref_cache.pl | 48 +++++++++++++++++++++++++ > 1 file changed, 48 insertions(+) > create mode 100755 misc/maintenance/check_syspref_cache.pl > >diff --git a/misc/maintenance/check_syspref_cache.pl b/misc/maintenance/check_syspref_cache.pl >new file mode 100755 >index 0000000000..809ecaae05 >--- /dev/null >+++ b/misc/maintenance/check_syspref_cache.pl >@@ -0,0 +1,48 @@ >+#! /usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Koha::Script; >+use Koha::Caches; >+use Koha::Config::SysPrefs; >+use C4::Context; >+ >+=head1 NAME >+ >+check_syspref_cache.pl >+ >+=head1 SYNOPSIS >+ >+ perl check_syspref_cache.pl >+ >+=head1 DESCRIPTION >+ >+Catch data inconsistencies in cached sysprefs vs those in the database >+ >+=cut >+ >+ >+my $syspref_cache = Koha::Caches->get_instance('syspref'); >+my $prefs = Koha::Config::SysPrefs->search(); >+ >+while (my $pref = $prefs->next) { >+ my $var = lc $pref->variable; >+ my $cached_var = $syspref_cache->get_from_cache("syspref_$var"); >+ next unless $cached_var; >+ print "$var: value in cache is $cached_var and value in db is ".$pref->value,"\n" unless $cached_var eq $pref->value; >+} >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24272
:
96467
|
113135
|
113193
| 115029 |
115192
|
115412
|
115413