Skip to content

Commit

Permalink
Item13897: Undone setlib.cfg erroneous changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
vrurg committed Aug 10, 2016
1 parent 0a8defa commit cdbd23a
Showing 1 changed file with 80 additions and 12 deletions.
92 changes: 80 additions & 12 deletions core/bin/setlib.cfg
Original file line number Diff line number Diff line change
@@ -1,14 +1,84 @@
#! /usr/bin/env perl
# See bottom of file for license and copyright information
use Cwd;
use lib Cwd::abs_path("../lib");
use Foswiki::App;
use Plack::Loader;

my $app = sub {
return Foswiki::App->run( env => shift, );
};
Plack::Loader->auto->run($app);
#
# setlib.cfg: determines the defaults for Foswiki and Perl library paths

###########################################################################
# DO NOT CHANGE THIS FILE - instead, create a file called LocalLib.cfg #
# using the LocalLib.cfg.txt template file and customise your settings in #
# there. They will override any settings in this file. #
###########################################################################

# for development, you can enable ASSERTS by adding
# $ENV{FOSWIKI_ASSERTS} = 1;
# to your bin/LocalLib.cfg

# Declare package Foswiki, so globals end up in $Foswiki space
package Foswiki;

use vars qw( $foswikiLibPath @localPerlLibPath );

my $LocalLib = __FILE__; # the dir where this setlib.cfg resides
$LocalLib =~ s/setlib.cfg$/LocalLib.cfg/;
require $LocalLib if -r $LocalLib;
# if foswikiLibPath isn't defined, then see if $twikiLibPath is
# for compatibility
$foswikiLibPath = $twikiLibPath unless defined( $foswikiLibPath );

unless (( defined ($foswikiLibPath) ) and (-e $foswikiLibPath)) {
use Cwd qw( abs_path );
my $bindir = __FILE__;
$bindir =~ s/setlib.cfg$//;
( $foswikiLibPath ) = ($foswikiLibPath = Cwd::abs_path( "$bindir../lib" )) =~ /(.*)/;
}
if ($foswikiLibPath eq "") {
$foswikiLibPath = "../lib";
warn "using relative path for libs - some plugins may break";
}

# Prepend to @INC, the Perl search path for modules
unshift @INC, $foswikiLibPath;
unshift @INC, @localPerlLibPath if @localPerlLibPath;
# Append lib/CPAN/lib for absolutely needed dependencies
push @INC, "$foswikiLibPath/CPAN/lib";

# Foswiki won't run at all without these:
my %missing;

foreach (qw( JSON Error CGI CGI::Session File::Copy::Recursive Crypt::PasswdMD5 )) {
eval "require $_";
$missing{$_} = $@ if $@;
}

if ( scalar %missing ) {
print "Content-type: text/plain\n\n";
print
"**** ERROR ****\nThe following critical dependencies are missing from your installation:\n";
foreach my $key ( sort keys %missing ) {
$missing{$key} =~ m/^(.*?(?:\@INC|CPAN\.))/;
print " ... $key: $1 \n";
}
print <<REPORT;

Please install these modules and then ensure all dependencies are installed by either:
- viewing the System.PerlDependencyReport in your local Foswki, or
- running the CLI shell script tools/dependencies from your server's command line.
You can get a complete list of Perl module dependencies by viewing System.SystemRequirements
on your local system or at http://foswiki.org/System/SystemRequirements.
Foswiki will not operate correctly unless the required dependencies are installed.
Your current library search path \@INC contains:
REPORT
print " " . join( "\n ", @INC ) . "\n";
print "\nYou can adjust the search path by editing bin/LocalLib.cfg\n";
exit;
}
1; # Return success for module loading
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Expand All @@ -34,5 +104,3 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
As per the GPL, removal of this notice is prohibited.
# vim: ft=perl

0 comments on commit cdbd23a

Please sign in to comment.