Bugzilla – Attachment 80360 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.07 KB, created by
Josef Moravec
on 2018-10-10 15:18:00 UTC
(
hide
)
Description:
Bug 21502: Add check for YAML formatted system preferences to about page
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-10-10 15:18:00 UTC
Size:
5.07 KB
patch
obsolete
>From ff96eb834878a8b9c25322275189658cf8d2c297 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 >--- > 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 0e88d8a..0b60f2c 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; >@@ -378,6 +379,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 650e9c2..cf9966a 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> >@@ -300,6 +300,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 %] > >@@ -371,6 +376,7 @@ > [% END %] > </table> > [% END %] >+ > [% ELSE %] > <p>No warnings.</p> > [% END %] >-- >2.1.4
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