Bugzilla – Attachment 51703 Details for
Bug 16441
C4::Letters::getletter is not plack safe
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 16441: Do not use a package variable to cache C4::Letters::getletter
Bug-16441-Do-not-use-a-package-variable-to-cache-C.patch (text/plain), 1.86 KB, created by
Srdjan Jankovic
on 2016-05-23 02:52:36 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 16441: Do not use a package variable to cache C4::Letters::getletter
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2016-05-23 02:52:36 UTC
Size:
1.86 KB
patch
obsolete
>From a203d2aca595eee943be15e4273d1744546170a6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 4 May 2016 19:43:43 +0100 >Subject: [PATCH] Bug 16441: Do not use a package variable to cache > C4::Letters::getletter > >C4::Letters::getletter use a package variable (%letter) to cache letter >returned by the subroutine. >I have not found any direct issues caused by that but it is safer to >remove it. >It won't be a big deal to hit the DBMS to get a valid letter when >needed. > >No test plan here, just confirm that the changes make sense. > >Signed-off-by: Srdjan <srdjan@catalyst.net.nz> >--- > C4/Letters.pm | 11 ----------- > 1 file changed, 11 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index f327890..1d0c3c0 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -200,12 +200,6 @@ sub GetLettersAvailableForALibrary { > > } > >-# FIXME: using our here means that a Plack server will need to be >-# restarted fairly regularly when working with this routine. >-# A better option would be to use Koha::Cache and use a cache >-# that actually works in a persistent environment, but as a >-# short-term fix, our will work. >-our %letter; > sub getletter { > my ( $module, $code, $branchcode, $message_transport_type ) = @_; > $message_transport_type //= '%'; >@@ -218,10 +212,6 @@ sub getletter { > } > $branchcode //= ''; > >- if ( my $l = $letter{$module}{$code}{$branchcode}{$message_transport_type} ) { >- return { %$l }; # deep copy >- } >- > my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare(q{ > SELECT * >@@ -234,7 +224,6 @@ sub getletter { > my $line = $sth->fetchrow_hashref > or return; > $line->{'content-type'} = 'text/html; charset="UTF-8"' if $line->{is_html}; >- $letter{$module}{$code}{$branchcode}{$message_transport_type} = $line; > return { %$line }; > } > >-- >2.7.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 16441
:
51218
|
51703
|
52120
|
52130
|
52217
|
52218