Bugzilla – Attachment 51247 Details for
Bug 16455
TagsExternalDictionary does not work under Plack
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16455: Remove the "Too late to run INIT block" from C4::Tags
Bug-16455-Remove-the-Too-late-to-run-INIT-block-fr.patch (text/plain), 2.11 KB, created by
Jonathan Druart
on 2016-05-05 16:00:24 UTC
(
hide
)
Description:
Bug 16455: Remove the "Too late to run INIT block" from C4::Tags
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-05-05 16:00:24 UTC
Size:
2.11 KB
patch
obsolete
>From 0cbf5a8f2d35fc3afb92a11b5c07001980b32b57 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 5 May 2016 16:58:06 +0100 >Subject: [PATCH] Bug 16455: Remove the "Too late to run INIT block" from > C4::Tags > >The pref TagsExternalDictionary is used to tell Lingua::Ispell to use an >other dictionary, different from the default one (/usr/bin/ispell). > >To do so we need to set $Lingua::Ispell::path to the expected path. >It's currently done in the INIT block. > >If you try to use C4::Tags, you will get the famous "Too late to run >INIT block at C4/Tags.pm line 74." warning. Plack use the INIT block to >load functions at run time, when we are using C4::Tags when hitting a pl >script, the compilation phase is finished and it's "too late to run INIT >block" from C4::Tags. > >I do not really know if it has an impact on the behavior of >Lingua::Ispell (i.e. is the path redefined?), but I know that this INIT >block is not executed when we want. > >Test plan: >under Plack, >- hit /cgi-bin/koha/opac-search.pl and confirm that the warning does no >longer appears >- Use another dictionnary (??), fill TagsExternalDictionary with its > path and confirm that it is used by the tags approval system >--- > C4/Tags.pm | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > >diff --git a/C4/Tags.pm b/C4/Tags.pm >index cbdb0a7..c554404 100644 >--- a/C4/Tags.pm >+++ b/C4/Tags.pm >@@ -57,7 +57,9 @@ BEGIN { > } > if ($ext_dict) { > require Lingua::Ispell; >- import Lingua::Ispell qw(spellcheck add_word_lc save_dictionary); >+ import Lingua::Ispell qw(spellcheck add_word_lc); >+ $Lingua::Ispell::path = $ext_dict; >+ $debug and print STDERR "\$Lingua::Ispell::path = $Lingua::Ispell::path\n"; > } > } > >@@ -67,12 +69,6 @@ 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"; >-} >- > sub get_filters { > my $query = "SELECT * FROM tags_filters "; > my ($sth); >-- >2.7.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 16455
:
51247
|
51970
|
52051
|
52193