Bugzilla – Attachment 40924 Details for
Bug 9006
autoload in C4::Context is a bad idea
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 9006: Remove AUTOLOAD in C4::Context
PASSED-QA-Bug-9006-Remove-AUTOLOAD-in-C4Context.patch (text/plain), 5.06 KB, created by
Kyle M Hall (khall)
on 2015-07-10 14:42:54 UTC
(
hide
)
Description:
[PASSED QA] Bug 9006: Remove AUTOLOAD in C4::Context
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-07-10 14:42:54 UTC
Size:
5.06 KB
patch
obsolete
>From 3be2ff19b4b7a1ad2b756fbdf9dedeede7617ab2 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 1 Apr 2015 13:58:50 +0200 >Subject: [PATCH] [PASSED QA] Bug 9006: Remove AUTOLOAD in C4::Context > >Happily this was only used for intranetdir. >It's time to remove it and replace existing calls. > >I used the following commands to catch calls to C4::Context: >git grep 'C4::Context\->' | grep -v 'C4::Context->preference' | grep -v >'C4::Context->config' | grep -v 'C4::Context->userenv' | grep -v >'C4::Context->IsSuperLibrarian' | grep -v 'C4::Context->dbh' | grep -v >'C4::Context->set_preference' | grep -v '_syspref_cache' | grep -v >_userenv | grep -v 'C4::Context->interface' | grep -v >'C4::Context->Zconn' | grep -v 'C4::Context->queryparser' | grep -v >'C4::Context->tz' | grep -v 'C4::Context->boolean_preference' | grep -v >'C4::Context->memcached' > >NOTE: I applied 14428, and then did what I suggested in comment #2. > Only intranetdir references appeared. > > I applied this patch, and repeated. > Nothing appeared. This means the autoload references are > properly removed. > > koha qa test tools complained about whitespace, I just fixed > those. Though, we may wish to perltidy > auth_fields_substructure.pl on another bug. > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Context.pm | 18 ------------------ > Koha/FrameworkPlugin.pm | 2 +- > admin/auth_subfields_structure.pl | 4 ++-- > admin/marc_subfields_structure.pl | 4 ++-- > reports/manager.pl | 2 +- > 5 files changed, 6 insertions(+), 24 deletions(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 660a489..26eeb40 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -622,24 +622,6 @@ sub set_preference { > } > } > >-# AUTOLOAD >-# This implements C4::Config->foo, and simply returns >-# C4::Context->config("foo"), as described in the documentation for >-# &config, above. >- >-# FIXME - Perhaps this should be extended to check &config first, and >-# then &preference if that fails. OTOH, AUTOLOAD could lead to crappy >-# code, so it'd probably be best to delete it altogether so as not to >-# encourage people to use it. >-sub AUTOLOAD >-{ >- my $self = shift; >- >- $AUTOLOAD =~ s/.*:://; # Chop off the package name, >- # leaving only the function name. >- return $self->config($AUTOLOAD); >-} >- > =head2 Zconn > > $Zconn = C4::Context->Zconn >diff --git a/Koha/FrameworkPlugin.pm b/Koha/FrameworkPlugin.pm >index 39bb5ed..2d7390f 100644 >--- a/Koha/FrameworkPlugin.pm >+++ b/Koha/FrameworkPlugin.pm >@@ -256,7 +256,7 @@ sub _load { > } > > sub _valuebuilderpath { >- return C4::Context->intranetdir . "/cataloguing/value_builder"; >+ return C4::Context->config('intranetdir') . "/cataloguing/value_builder"; > #Formerly, intranetdir/cgi-bin was tested first. > #But the intranetdir from koha-conf already includes cgi-bin for > #package installs, single and standard installs. >diff --git a/admin/auth_subfields_structure.pl b/admin/auth_subfields_structure.pl >index 3833b48..6a960f2 100755 >--- a/admin/auth_subfields_structure.pl >+++ b/admin/auth_subfields_structure.pl >@@ -108,9 +108,9 @@ if ($op eq 'add_form') { > # 2 cases here : on CVS install, $cgidir does not need a /cgi-bin > # on a standard install, /cgi-bin need to be added. > # test one, then the other >- my $cgidir = C4::Context->intranetdir ."/cgi-bin"; >+ my $cgidir = C4::Context->config('intranetdir') ."/cgi-bin"; > unless (opendir(DIR, "$cgidir/cataloguing/value_builder")) { >- $cgidir = C4::Context->intranetdir; >+ $cgidir = C4::Context->config('intranetdir'); > opendir(DIR, "$cgidir/cataloguing/value_builder") || die "can't opendir $cgidir/value_builder: $!"; > } > while (my $line = readdir(DIR)) { >diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl >index c8b7815..5a7d356 100755 >--- a/admin/marc_subfields_structure.pl >+++ b/admin/marc_subfields_structure.pl >@@ -154,9 +154,9 @@ if ( $op eq 'add_form' ) { > # 2 cases here : on CVS install, $cgidir does not need a /cgi-bin > # on a standard install, /cgi-bin need to be added. > # test one, then the other >- my $cgidir = C4::Context->intranetdir . "/cgi-bin"; >+ my $cgidir = C4::Context->config('intranetdir') . "/cgi-bin"; > unless ( opendir( DIR, "$cgidir/cataloguing/value_builder" ) ) { >- $cgidir = C4::Context->intranetdir; >+ $cgidir = C4::Context->config('intranetdir'); > opendir( DIR, "$cgidir/cataloguing/value_builder" ) > || die "can't opendir $cgidir/value_builder: $!"; > } >diff --git a/reports/manager.pl b/reports/manager.pl >index e37da4f..647ca88 100755 >--- a/reports/manager.pl >+++ b/reports/manager.pl >@@ -44,7 +44,7 @@ $template->param(do_it => $do_it, > ); > my $cgidir = C4::Context->config('intranetdir')."/cgi-bin/reports/"; > unless (-r $cgidir and -d $cgidir) { >- $cgidir = C4::Context->intranetdir."/reports/"; >+ $cgidir = C4::Context->config('intranetdir')."/reports/"; > } > my $plugin = $cgidir.$report_name.".plugin"; > require $plugin; >-- >1.7.2.5
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 9006
:
37417
|
40349
|
40916
| 40924