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> Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
This commit is contained in:
parent
ea263a2284
commit
454becb78f
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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: $!";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue