Skip to content

Commit

Permalink
Item1152: Foswiki fails after upgrade to 1.0.2
Browse files Browse the repository at this point in the history
Reverting the change done in Item906 changeset 2514
Since noone can find a way to make these changes work in mod_perl
and FindBin many places is described as not working with mod_perl
this change needs to be reverted and another way will have to be found
We lost release 1.0.2 because of this and the people that introduced
the broken code has not done a thing to fix it.
So I am reverting so we can get the code to work again.


git-svn-id: http://svn.foswiki.org/trunk@2766 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
KennethLavrsen authored and KennethLavrsen committed Feb 27, 2009
1 parent 28e2e66 commit b078baf
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 91 deletions.
7 changes: 2 additions & 5 deletions core/bin/attach
Expand Up @@ -36,11 +36,8 @@ BEGIN {
$SIG{__DIE__} = \&Carp::confess;
}
$ENV{FOSWIKI_ACTION} = 'attach';
require FindBin;
my ($bin) = $FindBin::Bin =~ /^(.*)$/;
use Cwd ();
my ($setlibCfg) = Cwd::abs_path( "$bin/setlib.cfg" ) =~ /(.*)/;
require $setlibCfg;
@INC = ('.', grep { $_ ne '.' } @INC);
require 'setlib.cfg';
}

use Foswiki;
Expand Down
7 changes: 2 additions & 5 deletions core/bin/changes
Expand Up @@ -36,11 +36,8 @@ BEGIN {
$SIG{__DIE__} = \&Carp::confess;
}
$ENV{FOSWIKI_ACTION} = 'changes';
require FindBin;
my ($bin) = $FindBin::Bin =~ /^(.*)$/;
use Cwd ();
my ($setlibCfg) = Cwd::abs_path( "$bin/setlib.cfg" ) =~ /(.*)/;
require $setlibCfg;
@INC = ('.', grep { $_ ne '.' } @INC);
require 'setlib.cfg';
}

use Foswiki;
Expand Down
7 changes: 2 additions & 5 deletions core/bin/edit
Expand Up @@ -36,11 +36,8 @@ BEGIN {
$SIG{__DIE__} = \&Carp::confess;
}
$ENV{FOSWIKI_ACTION} = 'edit';
require FindBin;
my ($bin) = $FindBin::Bin =~ /^(.*)$/;
use Cwd ();
my ($setlibCfg) = Cwd::abs_path( "$bin/setlib.cfg" ) =~ /(.*)/;
require $setlibCfg;
@INC = ('.', grep { $_ ne '.' } @INC);
require 'setlib.cfg';
}

use Foswiki;
Expand Down
7 changes: 2 additions & 5 deletions core/bin/login
Expand Up @@ -36,11 +36,8 @@ BEGIN {
$SIG{__DIE__} = \&Carp::confess;
}
$ENV{FOSWIKI_ACTION} = 'login';
require FindBin;
my ($bin) = $FindBin::Bin =~ /^(.*)$/;
use Cwd ();
my ($setlibCfg) = Cwd::abs_path( "$bin/setlib.cfg" ) =~ /(.*)/;
require $setlibCfg;
@INC = ('.', grep { $_ ne '.' } @INC);
require 'setlib.cfg';
}

use Foswiki;
Expand Down
7 changes: 2 additions & 5 deletions core/bin/logon
Expand Up @@ -36,11 +36,8 @@ BEGIN {
$SIG{__DIE__} = \&Carp::confess;
}
$ENV{FOSWIKI_ACTION} = 'logon';
require FindBin;
my ($bin) = $FindBin::Bin =~ /^(.*)$/;
use Cwd ();
my ($setlibCfg) = Cwd::abs_path( "$bin/setlib.cfg" ) =~ /(.*)/;
require $setlibCfg;
@INC = ('.', grep { $_ ne '.' } @INC);
require 'setlib.cfg';
}

use Foswiki;
Expand Down
7 changes: 2 additions & 5 deletions core/bin/rdiff
Expand Up @@ -36,11 +36,8 @@ BEGIN {
$SIG{__DIE__} = \&Carp::confess;
}
$ENV{FOSWIKI_ACTION} = 'rdiff';
require FindBin;
my ($bin) = $FindBin::Bin =~ /^(.*)$/;
use Cwd ();
my ($setlibCfg) = Cwd::abs_path( "$bin/setlib.cfg" ) =~ /(.*)/;
require $setlibCfg;
@INC = ('.', grep { $_ ne '.' } @INC);
require 'setlib.cfg';
}

use Foswiki;
Expand Down
7 changes: 2 additions & 5 deletions core/bin/rdiffauth
Expand Up @@ -36,11 +36,8 @@ BEGIN {
$SIG{__DIE__} = \&Carp::confess;
}
$ENV{FOSWIKI_ACTION} = 'rdiffauth';
require FindBin;
my ($bin) = $FindBin::Bin =~ /^(.*)$/;
use Cwd ();
my ($setlibCfg) = Cwd::abs_path( "$bin/setlib.cfg" ) =~ /(.*)/;
require $setlibCfg;
@INC = ('.', grep { $_ ne '.' } @INC);
require 'setlib.cfg';
}

use Foswiki;
Expand Down
7 changes: 2 additions & 5 deletions core/bin/register
Expand Up @@ -36,11 +36,8 @@ BEGIN {
$SIG{__DIE__} = \&Carp::confess;
}
$ENV{FOSWIKI_ACTION} = 'register';
require FindBin;
my ($bin) = $FindBin::Bin =~ /^(.*)$/;
use Cwd ();
my ($setlibCfg) = Cwd::abs_path( "$bin/setlib.cfg" ) =~ /(.*)/;
require $setlibCfg;
@INC = ('.', grep { $_ ne '.' } @INC);
require 'setlib.cfg';
}

use Foswiki;
Expand Down
7 changes: 2 additions & 5 deletions core/bin/rename
Expand Up @@ -36,11 +36,8 @@ BEGIN {
$SIG{__DIE__} = \&Carp::confess;
}
$ENV{FOSWIKI_ACTION} = 'rename';
require FindBin;
my ($bin) = $FindBin::Bin =~ /^(.*)$/;
use Cwd ();
my ($setlibCfg) = Cwd::abs_path( "$bin/setlib.cfg" ) =~ /(.*)/;
require $setlibCfg;
@INC = ('.', grep { $_ ne '.' } @INC);
require 'setlib.cfg';
}

use Foswiki;
Expand Down
7 changes: 2 additions & 5 deletions core/bin/resetpasswd
Expand Up @@ -36,11 +36,8 @@ BEGIN {
$SIG{__DIE__} = \&Carp::confess;
}
$ENV{FOSWIKI_ACTION} = 'resetpasswd';
require FindBin;
my ($bin) = $FindBin::Bin =~ /^(.*)$/;
use Cwd ();
my ($setlibCfg) = Cwd::abs_path( "$bin/setlib.cfg" ) =~ /(.*)/;
require $setlibCfg;
@INC = ('.', grep { $_ ne '.' } @INC);
require 'setlib.cfg';
}

use Foswiki;
Expand Down
7 changes: 2 additions & 5 deletions core/bin/rest
Expand Up @@ -36,11 +36,8 @@ BEGIN {
$SIG{__DIE__} = \&Carp::confess;
}
$ENV{FOSWIKI_ACTION} = 'rest';
require FindBin;
my ($bin) = $FindBin::Bin =~ /^(.*)$/;
use Cwd ();
my ($setlibCfg) = Cwd::abs_path( "$bin/setlib.cfg" ) =~ /(.*)/;
require $setlibCfg;
@INC = ('.', grep { $_ ne '.' } @INC);
require 'setlib.cfg';
}

use Foswiki;
Expand Down
47 changes: 16 additions & 31 deletions core/bin/setlib.cfg
Expand Up @@ -30,29 +30,18 @@
# $ENV{FOSWIKI_ASSERTS} = 1;
# to your bin/LocalLib.cfg

use strict;
use warnings;

# These might be defined in LocalLib.cfg
our ( $foswikiLibPath, @localPerlLibPath, $CPANBASE );
our $twikiLibPath; # For compatibility

my $LocalLib = __FILE__; # the dir where this setlib.cfg resides
$LocalLib =~ s/setlib.cfg$/LocalLib.cfg/;
require $LocalLib if -r $LocalLib;
use vars qw( $foswikiLibPath @localPerlLibPath );

eval 'require "LocalLib.cfg"';
# if foswikiLibPath isn't defined, then see if $twikiLibPath is
# for compatibility
$foswikiLibPath = $twikiLibPath unless defined($foswikiLibPath);
$foswikiLibPath = $twikiLibPath unless defined( $foswikiLibPath );

unless ( ( defined($foswikiLibPath) ) and ( -e $foswikiLibPath ) ) {
require FindBin;
FindBin->again; # If we're running under mod_perl or the like
my ($bin) = $FindBin::Bin =~ /^(.*)$/;
($foswikiLibPath) =
( $foswikiLibPath = Cwd::abs_path("$bin/../lib") ) =~ /(.*)/;
unless (( defined ($foswikiLibPath) ) and (-e $foswikiLibPath)) {
use Cwd qw( abs_path );
( $foswikiLibPath ) = ($foswikiLibPath = Cwd::abs_path( "../lib" )) =~ /(.*)/;
}
if ( $foswikiLibPath eq "" ) {
if ($foswikiLibPath eq "") {
$foswikiLibPath = "../lib";
warn "using relative path for libs - some plugins may break";
}
Expand All @@ -61,23 +50,19 @@ if ( $foswikiLibPath eq "" ) {
my $defaultingCPANBASE = !defined($CPANBASE);
$CPANBASE = "$foswikiLibPath/CPAN/lib/" unless $CPANBASE;
if ( -e $CPANBASE ) {
require Config;
my $VER = $Config::Config{version};
my $SITEARCH = $Config::Config{archname};
push @localPerlLibPath,
(
"$CPANBASE/arch", "$CPANBASE/$VER/$SITEARCH",
"$CPANBASE/$VER", "$CPANBASE"
);
require Config;
my $VER = $Config::Config{version};
my $SITEARCH = $Config::Config{archname};
push @localPerlLibPath, ( "$CPANBASE/arch", "$CPANBASE/$VER/$SITEARCH", "$CPANBASE/$VER", "$CPANBASE" );
}

# Prepend to @INC, the Perl search path for modules
unshift @INC, $foswikiLibPath;
if ($defaultingCPANBASE) {
push @INC, @localPerlLibPath if @localPerlLibPath;
}
else {
unshift @INC, @localPerlLibPath if @localPerlLibPath;
push @INC, @localPerlLibPath if @localPerlLibPath;
} else {
unshift @INC, @localPerlLibPath if @localPerlLibPath;
}

1; # Return success for module loading
1; # Return success for module loading

7 changes: 2 additions & 5 deletions core/bin/view
Expand Up @@ -36,11 +36,8 @@ BEGIN {
$SIG{__DIE__} = \&Carp::confess;
}
$ENV{FOSWIKI_ACTION} = 'view';
require FindBin;
my ($bin) = $FindBin::Bin =~ /^(.*)$/;
use Cwd ();
my ($setlibCfg) = Cwd::abs_path( "$bin/setlib.cfg" ) =~ /(.*)/;
require $setlibCfg;
@INC = ('.', grep { $_ ne '.' } @INC);
require 'setlib.cfg';
}

use Foswiki;
Expand Down

0 comments on commit b078baf

Please sign in to comment.