Skip to content

Commit

Permalink
Item13897: Fixing the previous commit.
Browse files Browse the repository at this point in the history
It didn't actually work.
  • Loading branch information
vrurg committed Sep 19, 2016
1 parent d5fa688 commit d48bdb3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 37 deletions.
26 changes: 16 additions & 10 deletions core/bin/foswiki.psgi
Expand Up @@ -4,18 +4,24 @@ use v5.14;
use Cwd;
use File::Spec;

my $root = $ENV{FOSWIKI_HOME};
if ( !$root ) {
# Try to guess our root dir by looking into %INC
my $incKey = ( grep { /\/foswiki.*\.psgi$/ } keys %INC )[0];
my $scriptFile = $INC{$incKey};
my ( $volume, $scriptDir ) = File::Spec->splitpath($scriptFile);
$root =
File::Spec->catpath( $volume,
File::Spec->catdir( $scriptDir, File::Spec->updir ), "" );
my $root;

BEGIN {
$root = $ENV{FOSWIKI_HOME};
if ( !$root ) {

# Try to guess our root dir by looking into %INC
my $incKey = ( grep { /\/foswiki.*\.psgi$/ } keys %INC )[0];
my $scriptFile = $INC{$incKey};
my ( $volume, $scriptDir ) = File::Spec->splitpath($scriptFile);
$root =
File::Spec->catpath( $volume,
File::Spec->catdir( $scriptDir, File::Spec->updir ), "" );
}

push @INC, File::Spec->catdir( $root, "lib" );
}

use lib Cwd::abs_path( File::Spec->catdir( $root, "lib" ) );
use Plack::Builder;
use Foswiki::App;

Expand Down
53 changes: 26 additions & 27 deletions core/bin/foswiki_debug.psgi
@@ -1,24 +1,31 @@
#!/usr/bin/env perl
# See bottom of file for license and copyright information
use v5.14;
use Cwd;
use File::Spec;
use Data::Dumper;

my $root = $ENV{FOSWIKI_HOME};
if ( !$root ) {
my $root;

# Try to guess our root dir by looking into %INC
my $incKey = ( grep { /\/foswiki.*\.psgi$/ } keys %INC )[0];
my $scriptFile = $INC{$incKey};
my ( $volume, $scriptDir ) = File::Spec->splitpath($scriptFile);
$root =
File::Spec->catpath( $volume,
File::Spec->catdir( $scriptDir, File::Spec->updir ), "" );
}
BEGIN {
$root = $ENV{FOSWIKI_HOME};
if ( !$root ) {

# Try to guess our root dir by looking into %INC
my $incKey = ( grep { /\/foswiki.*\.psgi$/ } keys %INC )[0];
my $scriptFile = $INC{$incKey};
my ( $volume, $scriptDir ) = File::Spec->splitpath($scriptFile);
$root =
File::Spec->catpath( $volume,
File::Spec->catdir( $scriptDir, File::Spec->updir ), "" );
}

use lib Cwd::abs_path( File::Spec->catdir( $root, "lib" ) );
push @INC, File::Spec->catdir( $root, "lib" );
}
use Plack::Builder;
use Foswiki::App;
use HTTP::Server::PSGI;
use Devel::Leak;
use Devel::Leak::Object;

use constant CHECKLEAK => 0;

Expand All @@ -43,27 +50,19 @@ my $app = sub {
eval {
require Devel::MAT::Dumper;
Devel::MAT::Dumper::dump(
$starting_root . "/working/logs/foswiki_debug_psgi.pmat" );
$root . "/working/logs/foswiki_debug_psgi.pmat" );
};
}

return $rc;
};

my $server = HTTP::Server::PSGI->new(
host => "127.0.0.1",
port => 5000,
timeout => 120,
);

$server->run(
builder {
enable 'Plack::Middleware::Static',
path => qr/^\/pub\//,
root => $root;
$app;
}
);
builder {
enable 'Plack::Middleware::Static',
path => qr/^\/pub\//,
root => $root;
$app;
};
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Expand Down

0 comments on commit d48bdb3

Please sign in to comment.