Bug 28617: Remove kohalib.pl and rely on PERL5LIB

The purpose of this script was to load the relevant Koha lib for the
different scripts (installation, cronjob, CLI, etc.)
However it is not used consistently and we prefer to rely on PERL5LIB.

From bug 28617 comment 6 from Galen:
"""
Time marches on, and one of the motivations for having kohalib.pl - making
it possible to install Koha without setting a single environment variable -
has been obviated by the vast improvements in the ease of installing Koha.

Consequently, I think kohalib.pl can go away.
"""

Test plan:
confirm that the changes make sense and that kohalib.pl can be removed
safely.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2021-07-19 11:00:52 +02:00 committed by Fridolin Somers
parent a339a27503
commit 238fabc4ab
64 changed files with 0 additions and 459 deletions

View File

@ -693,7 +693,6 @@ $config{'BIB_RETRIEVAL_CFG'} = 'retrieval-info-bib-dom.xml';
if ($config{'INSTALL_MODE'} ne "dev") {
push @{ $pl_files->{'rewrite-config.PL'} }, (
'blib/PERL_MODULE_DIR/C4/Context.pm',
'blib/SCRIPT_NONDEV_DIR/kohalib.pl'
);
}

View File

@ -17,11 +17,6 @@
use Modern::Perl;
BEGIN {
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script;
use Getopt::Long qw( GetOptions );

View File

@ -4,12 +4,6 @@
use strict;
#use warnings; FIXME - Bug 2505
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/kohalib.pl" };
}
# Koha modules used
use Koha::Script;

View File

@ -3,12 +3,6 @@
use strict;
#use warnings; FIXME - Bug 2505
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/kohalib.pl" };
}
# Koha modules used
use Koha::Script;

View File

@ -3,12 +3,6 @@
# Written by TG on 10/04/2006
use strict;
#use warnings; FIXME - Bug 2505
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/kohalib.pl" };
}
# Koha modules used

View File

@ -5,13 +5,6 @@
use strict;
#use warnings; FIXME - Bug 2505
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/kohalib.pl" };
}
# Koha modules used
use Koha::Script;
use MARC::Record;

View File

@ -4,12 +4,6 @@
# Revised by Joshua Ferraro on 03/31/2006
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/kohalib.pl" };
}
# Koha modules used
use Koha::Script;

View File

@ -2,12 +2,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/kohalib.pl" };
}
use Koha::Script;
use C4::Context;

View File

@ -40,12 +40,6 @@ use strict;
use warnings;
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script -cron;
use C4::Context;
use C4::Letters;

View File

@ -20,14 +20,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script -cron;
use C4::Context;
use Koha::Patrons;

View File

@ -3,12 +3,6 @@
use strict;
#use warnings; FIXME - Bug 2505
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin;
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script -cron;
use C4::Koha;

View File

@ -32,13 +32,6 @@ use Koha::Script -cron;
use C4::Items qw( CartToShelf );
use C4::Log qw( cronlogaction );
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use C4::Context;
use Getopt::Long qw( GetOptions );

View File

@ -28,13 +28,6 @@ use constant DEFAULT_SEARCHHISTORY_PURGEDAYS => 30;
use constant DEFAULT_SHARE_INVITATION_EXPIRY_DAYS => 14;
use constant DEFAULT_DEBARMENTS_PURGEDAYS => 30;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script -cron;
use C4::Context;
use C4::Search;

View File

@ -23,14 +23,6 @@ use Modern::Perl;
binmode( STDOUT, ":encoding(UTF-8)" );
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
use Koha::Script -cron;

View File

@ -2,13 +2,6 @@
use Modern::Perl;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use CGI; # NOT a CGI script, this is just to keep C4::Templates::gettemplate happy
use Koha::Script -cron;
use C4::Context;

View File

@ -20,13 +20,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
# cancel all expired hold requests
use Koha::Script -cron;

View File

@ -8,12 +8,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script -cron;
use C4::HoldsQueue qw(CreateQueue);

View File

@ -42,13 +42,6 @@ use Modern::Perl;
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script -cron;
use C4::Reserves;
use C4::Log qw( cronlogaction );

View File

@ -18,13 +18,6 @@
use Modern::Perl;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );

View File

@ -17,14 +17,6 @@
use Modern::Perl;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
use DateTime;

View File

@ -21,14 +21,6 @@ use strict;
use warnings;
use utf8;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Getopt::Long qw( GetOptions );
use Koha::Script -cron;
use C4::ImportBatch qw( BatchCommitRecords );

View File

@ -27,12 +27,6 @@ longoverdue.pl cron script to set lost statuses on overdue materials.
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );

View File

@ -139,12 +139,6 @@ any field from the branches table
use Modern::Perl;
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script -cron;
use C4::Context;

View File

@ -20,14 +20,6 @@
use Modern::Perl;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
use Text::CSV_XS;

View File

@ -18,13 +18,6 @@
use Modern::Perl;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script -cron;
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );

View File

@ -19,12 +19,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script -cron;
use C4::Letters qw( SendQueuedMessages );

View File

@ -19,13 +19,6 @@
use Modern::Perl;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Getopt::Long qw( GetOptions );
use Koha::Script -cron;

View File

@ -55,13 +55,6 @@ use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
use Try::Tiny qw( catch try );
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script -cron;
use C4::Log qw( cronlogaction );

View File

@ -38,13 +38,6 @@ use Encode qw( decode );
use JSON qw( to_json );
use Try::Tiny qw( catch try );
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
=head1 NAME
runreport.pl - Run pre-existing saved reports

View File

@ -20,14 +20,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script -cron;
use C4::Context;
use C4::Serials qw( GetSubscription GetNextDate ModSerialStatus );

View File

@ -27,14 +27,6 @@
use Modern::Perl;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/kohalib.pl" };
}
use Date::Calc qw( Date_to_Days );
use Koha::Script -cron;

View File

@ -20,14 +20,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );

View File

@ -20,14 +20,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );

View File

@ -17,13 +17,6 @@
use Modern::Perl;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use C4::Context;
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );

View File

@ -20,14 +20,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );

View File

@ -5,12 +5,6 @@
use strict;
#use warnings; FIXME - Bug 2505
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/kohalib.pl" };
}
use Koha::Script;
use C4::Context;

View File

@ -1,52 +0,0 @@
#!/usr/bin/perl
# Copyright (C) 2007 LibLime
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
# This script is used by command-line utilities to set
# @INC properly -- specifically, to point to the directory
# containing the installed version of the C4 modules.
#
# This depends on the installer replacing the \_\_PERL_MODULE_DIR\_\_
# string with the path to the Koha modules directory. This is done
# only during a 'standard' or 'single' mode installation. If Koha
# is being run from a git checkout (and thus installed in 'dev' mode),
# this is a no-op.
#
# To use this script, a command-line utility should do the following before
# 'use'ing any C4 modules.
#
# BEGIN {
# use FindBin;
# eval { require "$FindBin::Bin/kohalib.pl" };
# # adjust path to point to kohalib.pl relative
# # to location of script
# }
#
use strict;
#use warnings; FIXME - Bug 2505
my $module_dir;
BEGIN {
$module_dir = '__PERL_MODULE_DIR__';
die if $module_dir =~ /^[_]{2}PERL_MODULE_DIR[_]{2}$/;
}
use lib $module_dir;
1;

View File

@ -3,14 +3,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/kohalib.pl" };
}
use Koha::Script;
use C4::Context;
use C4::Biblio qw(

View File

@ -4,12 +4,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/kohalib.pl" };
}
use HTTPD::Bench::ApacheBench;
use LWP::UserAgent;

View File

@ -4,12 +4,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/kohalib.pl" };
}
use Getopt::Long qw( GetOptions );
use HTTPD::Bench::ApacheBench;

View File

@ -7,11 +7,6 @@
use strict;
use warnings;
BEGIN {
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script;
sub process {

View File

@ -7,11 +7,6 @@
use strict;
use warnings;
BEGIN {
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script;
use C4::Biblio qw( GetMarcBiblio ModBiblio );
use Getopt::Long qw( GetOptions );

View File

@ -19,12 +19,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script;
use C4::Context;

View File

@ -19,12 +19,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script;
use C4::Context;

View File

@ -20,13 +20,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script;
use C4::Context;

View File

@ -18,13 +18,6 @@
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
my $lib = "$FindBin::Bin/../kohalib.pl";
eval { require $lib };
}
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );

View File

@ -19,12 +19,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
# possible modules to use
use Getopt::Long qw( GetOptions );

View File

@ -19,12 +19,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
# possible modules to use
use Getopt::Long qw( GetOptions );

View File

@ -5,14 +5,6 @@
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../../kohalib.pl" };
}
use C4::Context;
my $dbh = C4::Context->dbh();
my $sth = $dbh->prepare("Show tables");

View File

@ -1,11 +1,5 @@
#!/usr/bin/perl
use Modern::Perl;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../../kohalib.pl" };
}
use C4::Context;
#use MARC::File::XML(BinaryEncoding=>"utf8");
#use MARC::File::USMARC;

View File

@ -1,11 +1,5 @@
#!/usr/bin/perl
use Modern::Perl;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../../kohalib.pl" };
}
use C4::Context;
use MARC::File::XML(BinaryEncoding=>"utf8");
use C4::AuthoritiesMarc;

View File

@ -4,12 +4,6 @@
# Revised by Joshua Ferraro on 03/31/2006
use strict;
#use warnings; FIXME - Bug 2505
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../../kohalib.pl" };
}
# Koha modules used

View File

@ -4,12 +4,6 @@
# scraped from updatedatabase for dev week by chris@katipo.co.nz
use strict;
#use warnings; FIXME - Bug 2505
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../../kohalib.pl" };
}
use C4::Context;
use C4::AuthoritiesMarc;
use MARC::Record;

View File

@ -2,12 +2,6 @@
use Modern::Perl;
# script to shift marc to biblioitems
# scraped from updatedatabase for dev week by chris@katipo.co.nz
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../../kohalib.pl" };
}
use C4::Context;
use MARC::Record;
use MARC::File::XML ( BinaryEncoding => 'utf8' );

View File

@ -4,12 +4,6 @@
# Revised by Joshua Ferraro on 03/31/2006
use strict;
#use warnings; FIXME - Bug 2505
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../../kohalib.pl" };
}
# Koha modules used

View File

@ -4,12 +4,6 @@
# Revised by Joshua Ferraro on 03/31/2006
use strict;
#use warnings; FIXME - Bug 2505
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../../kohalib.pl" };
}
# Koha modules used

View File

@ -3,12 +3,6 @@
use Modern::Perl;
#use diagnostics;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
# Koha modules used
use MARC::File::USMARC;

View File

@ -23,14 +23,6 @@
use strict;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/kohalib.pl" };
}
# Koha modules used
use Koha::Script;
use C4::Context;

View File

@ -2,12 +2,6 @@
use strict;
#use warnings; FIXME - Bug 2505
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script;
use C4::Context;

View File

@ -41,14 +41,6 @@ use Koha::Database;
binmode STDOUT, ':encoding(UTF-8)';
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
my $help;
my $confirm;
my $test;

View File

@ -22,13 +22,6 @@ use warnings;
# Script to switch the MARC21 440$anv and 490$av information
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/../kohalib.pl" };
}
use Koha::Script;
use C4::Biblio qw( GetFrameworkCode GetMarcBiblio ModBiblioMarc );
use C4::Context;

View File

@ -20,12 +20,6 @@
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin ();
eval { require "$FindBin::Bin/kohalib.pl" };
}
use Koha::Script;
use C4::Context;

View File

@ -35,7 +35,6 @@ my @dirs = (
);
$Test::Strict::TEST_STRICT = 0;
$Test::Strict::TEST_SKIP = [ 'misc/kohalib.pl' ];
my $ncpu;
if ( $ENV{KOHA_PROVE_CPUS} ) {

View File

@ -23,11 +23,6 @@ use File::Find;
use Test::More;
BEGIN {
use FindBin;
eval { require "$FindBin::Bin/../misc/kohalib.pl" };
}
my $filebase = "$FindBin::Bin/../koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences";
my @files;