Bugzilla – Attachment 88562 Details for
Bug 21502
Add checks for YAML formatted system preferences to about page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21502: Add check for YAML formatted system preferences to about page
Bug-21502-Add-check-for-YAML-formatted-system-pref.patch (text/plain), 5.18 KB, created by
Michal Denar
on 2019-04-23 19:37:49 UTC
(
hide
)
Description:
Bug 21502: Add check for YAML formatted system preferences to about page
Filename:
MIME Type:
Creator:
Michal Denar
Created:
2019-04-23 19:37:49 UTC
Size:
5.18 KB
patch
obsolete
>From b93ab6fea7ae08feadef92062ccc92b086e67c4f Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Fri, 5 Oct 2018 13:43:54 +0000 >Subject: [PATCH] Bug 21502: Add check for YAML formatted system preferences to > about page > >So far there are these yaml formatted preferences: > UpdateNotForLoanStatusOnCheckin > OpacHiddenItems > BibtexExportAdditionalFields > RisExportAdditionalFields > UpdateItemWhenLostFromHoldList > MarcFieldsToOrder > MarcItemFieldsToOrder > >Test plan: >1) Add some badly formatted YAML into some of preferences listed above >2) Check the System information tab on About page for appropriate warnings > >Signed-off-by: Michal Denar <black23@gmail.com> > >Signed-off-by: Michal Denar <black23@gmail.com> >--- > about.pl | 24 ++++++++++++++++++++++++ > koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 10 ++++++++-- > 2 files changed, 32 insertions(+), 2 deletions(-) > >diff --git a/about.pl b/about.pl >index 349dfc9668..f0becebac1 100755 >--- a/about.pl >+++ b/about.pl >@@ -32,6 +32,7 @@ use XML::Simple; > use Config; > use Search::Elasticsearch; > use Try::Tiny; >+use YAML; > > use C4::Output; > use C4::Auth; >@@ -385,6 +386,29 @@ if ( C4::Context->preference('WebBasedSelfCheck') > ); > } > >+# Test YAML system preferences >+# FIXME: This is list of current YAML formatted prefs, should by type of preference >+my @yaml_prefs = ( >+ "UpdateNotForLoanStatusOnCheckin", >+ "OpacHiddenItems", >+ "BibtexExportAdditionalFields", >+ "RisExportAdditionalFields", >+ "UpdateItemWhenLostFromHoldList", >+ "MarcFieldsToOrder", >+ "MarcItemFieldsToOrder" >+); >+my @bad_yaml_prefs; >+foreach my $syspref (@yaml_prefs) { >+ my $yaml = C4::Context->preference( $syspref ); >+ if ( $yaml ) { >+ eval { YAML::Load( "$yaml\n\n" ); }; >+ if ($@) { >+ push @bad_yaml_prefs, $syspref; >+ } >+ } >+} >+$template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs; >+ > { > my $dbh = C4::Context->dbh; > my $patrons = $dbh->selectall_arrayref( >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >index 2616a6efc3..36b33bce5b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >@@ -183,7 +183,7 @@ > </div> > > <div id="sysinfo"> >- [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnPrefAnonymousPatron_PatronDoesNotExist || warnNoActiveCurrency || QueryParserError || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps %] >+ [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnPrefAnonymousPatron_PatronDoesNotExist || warnNoActiveCurrency || QueryParserError || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs %] > [% IF (warnIsRootUser) %] > <h2>Warning regarding current user</h2> > <p>You are logged in as the database administrative user. This is not recommended because some parts of Koha will not function as expected when using this account.</p> >@@ -228,7 +228,7 @@ > <br/> > [% END %] > >- [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnPrefAnonymousPatron_PatronDoesNotExist || warnNoActiveCurrency || QueryParserError || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || oauth2_missing_deps %] >+ [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnPrefAnonymousPatron_PatronDoesNotExist || warnNoActiveCurrency || QueryParserError || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || oauth2_missing_deps || bad_yaml_prefs %] > <h2>Warnings regarding the system configuration</h2> > <table> > <caption>Preferences and parameters</caption> >@@ -305,6 +305,11 @@ > System preference 'RESTOAuth2ClientCredentials' is set, but the required Net::OAuth2::AuthorizationServer dependency is missing. The feature is disabled. > </td></tr> > [% END %] >+ [% IF bad_yaml_prefs %] >+ <tr><th scope="row"><b>Warning</b> </th><td> >+ Some YAML formatted system preferences have bad format: [% bad_yaml_prefs.join(', ') | html %] >+ </td></tr> >+ [% END %] > </table> > [% END %] > >@@ -376,6 +381,7 @@ > [% END %] > </table> > [% END %] >+ > [% ELSE %] > <p>No warnings.</p> > [% END %] >-- >2.11.0
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 21502
:
80085
|
80086
|
80360
|
80362
|
88462
|
88463
|
88464
|
88562
|
88563
|
88564
|
88655
|
88656
|
88657
|
88664