Bugzilla – Attachment 52027 Details for
Bug 16444
C4::Tags is not plack safe
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16444: Make C4::Tags plack safe
Bug-16444-Make-C4Tags-plack-safe.patch (text/plain), 2.27 KB, created by
Marcel de Rooy
on 2016-06-04 07:42:21 UTC
(
hide
)
Description:
Bug 16444: Make C4::Tags plack safe
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-06-04 07:42:21 UTC
Size:
2.27 KB
patch
obsolete
>From e80ebe4a46a342c76640d3516b18aad67b981d51 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 4 May 2016 20:20:51 +0100 >Subject: [PATCH] Bug 16444: Make C4::Tags plack safe >Content-Type: text/plain; charset=utf-8 > >C4::Tags use a package variable to cache the pref >TagsExternalDictionary, it's not needed and not safe. > >There is not test plan, just make sure the changes are consistent. > >Signed-off-by: Srdjan <srdjan@catalyst.net.nz> >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Tags.pm | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > >diff --git a/C4/Tags.pm b/C4/Tags.pm >index 09afd78..33d77d4 100644 >--- a/C4/Tags.pm >+++ b/C4/Tags.pm >@@ -30,7 +30,6 @@ use constant TAG_FIELDS => qw(tag_id borrowernumber biblionumber term language d > use constant TAG_SELECT => "SELECT " . join(',', TAG_FIELDS) . "\n FROM tags_all\n"; > > use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); >-our $ext_dict; > > BEGIN { > @ISA = qw(Exporter); >@@ -50,7 +49,7 @@ BEGIN { > stratify_tags > ); > # %EXPORT_TAGS = (); >- $ext_dict = C4::Context->preference('TagsExternalDictionary'); >+ my $ext_dict = C4::Context->preference('TagsExternalDictionary'); > if ($debug) { > require Data::Dumper; > import Data::Dumper qw(:DEFAULT); >@@ -69,6 +68,7 @@ More verose debugging messages are sent in the presence of non-zero $ENV{"DEBUG" > =cut > > INIT { >+ my $ext_dict = C4::Context->preference('TagsExternalDictionary'); > $ext_dict and $Lingua::Ispell::path = $ext_dict; > $debug and print STDERR "\$Lingua::Ispell::path = $Lingua::Ispell::path\n"; > } >@@ -367,6 +367,7 @@ sub is_approved { > my $term = shift or return; > my $sth = C4::Context->dbh->prepare("SELECT approved FROM tags_approval WHERE term = ?"); > $sth->execute($term); >+ my $ext_dict = C4::Context->preference('TagsExternalDictionary'); > unless ($sth->rows) { > $ext_dict and return (spellcheck($term) ? 0 : 1); # spellcheck returns empty on OK word > return 0; >@@ -390,6 +391,7 @@ sub get_tag_index { > sub whitelist { > my $operator = shift; > defined $operator or return; # have to test defined to allow =0 (kohaadmin) >+ my $ext_dict = C4::Context->preference('TagsExternalDictionary'); > if ($ext_dict) { > foreach (@_) { > spellcheck($_) or next; >-- >1.7.10.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 16444
:
51222
|
51244
|
51373
| 52027