Bugzilla – Attachment 120346 Details for
Bug 27246
Remove apache only code from C4::Context BEGIN
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27246: Remove obsolete BEGIN code from C4::Context
Bug-27246-Remove-obsolete-BEGIN-code-from-C4Contex.patch (text/plain), 4.16 KB, created by
Victor Grousset/tuxayo
on 2021-04-30 15:26:04 UTC
(
hide
)
Description:
Bug 27246: Remove obsolete BEGIN code from C4::Context
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2021-04-30 15:26:04 UTC
Size:
4.16 KB
patch
obsolete
>From a92c921298dc7ffe5ab9b30068dc3bcdcad833fe Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 16 Dec 2020 11:04:48 +0100 >Subject: [PATCH] Bug 27246: Remove obsolete BEGIN code from C4::Context > >We don't longer enter the HTTP_USER_AGENT conditional in the BEGIN block >of C4::Context. It was used when apache only was used. > >I am suggesting to remove it but keep the $CGI::VERSION < 4.08 condition >to keep support of all version (not sure it's needed but won't hurt). > >I have not found a lot of occurrences of KOHA_BACKTRACES and I am >assuming not much people are using it, we should prefer the dev_install >flag instead (to set environment="development" when plack is started and >enabled the starman trace) > >Test plan: >Regression test what you think is useful >Confirm the above statements > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >Signed-off-by: David Cook <dcook@prosentient.com.au> >--- > C4/Context.pm | 65 ++++----------------------------------------------- > 1 file changed, 5 insertions(+), 60 deletions(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 01c33b438c..1ab0467eca 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -21,74 +21,19 @@ use Modern::Perl; > > use vars qw($AUTOLOAD $context @context_stack); > BEGIN { >- if ($ENV{'HTTP_USER_AGENT'}) { >- require CGI::Carp; >- # FIXME for future reference, CGI::Carp doc says >- # "Note that fatalsToBrowser does not work with mod_perl version 2.0 and higher." >- import CGI::Carp qw(fatalsToBrowser); >- sub handle_errors { >- my $msg = shift; >- my $debug_level; >- eval {C4::Context->dbh();}; >- if ($@){ >- $debug_level = 1; >- } >- else { >- $debug_level = C4::Context->preference("DebugLevel"); >- } >- >- print q(<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> >- <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"> >- <head><title>Koha Error</title></head> >- <body> >- ); >- if ($debug_level eq "2"){ >- # debug 2 , print extra info too. >- my %versions = get_versions(); >- >- # a little example table with various version info"; >- print " >- <h1>Koha error</h1> >- <p>The following fatal error has occurred:</p> >- <pre><code>$msg</code></pre> >- <table> >- <tr><th>Apache</th><td> $versions{apacheVersion}</td></tr> >- <tr><th>Koha</th><td> $versions{kohaVersion}</td></tr> >- <tr><th>Koha DB</th><td> $versions{kohaDbVersion}</td></tr> >- <tr><th>MySQL</th><td> $versions{mysqlVersion}</td></tr> >- <tr><th>OS</th><td> $versions{osVersion}</td></tr> >- <tr><th>Perl</th><td> $versions{perlVersion}</td></tr> >- </table>"; >- >- } elsif ($debug_level eq "1"){ >- print " >- <h1>Koha error</h1> >- <p>The following fatal error has occurred:</p> >- <pre><code>$msg</code></pre>"; >- } else { >- print "<p>production mode - trapped fatal error</p>"; >- } >- print "</body></html>"; >- } >- #CGI::Carp::set_message(\&handle_errors); >- ## give a stack backtrace if KOHA_BACKTRACES is set >- ## can't rely on DebugLevel for this, as we're not yet connected >- if ($ENV{KOHA_BACKTRACES}) { >- $main::SIG{__DIE__} = \&CGI::Carp::confess; >- } >+ if ( $ENV{'HTTP_USER_AGENT'} ) { # Only hit when plack is not enabled > > # Redefine multi_param if cgi version is < 4.08 > # Remove the "CGI::param called in list context" warning in this case >- require CGI; # Can't check version without the require. >- if (!defined($CGI::VERSION) || $CGI::VERSION < 4.08) { >+ require CGI; # Can't check version without the require. >+ if ( !defined($CGI::VERSION) || $CGI::VERSION < 4.08 ) { > no warnings 'redefine'; > *CGI::multi_param = \&CGI::param; > use warnings 'redefine'; > $CGI::LIST_CONTEXT_WARN = 0; > } >- } # else there is no browser to send fatals to! >-} >+ } >+}; > > use Carp; > use DateTime::TimeZone; >-- >2.31.1
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 27246
:
114431
|
120346
|
120436