Skip to content

Commit

Permalink
Item14180: Compatibiltiy with older foswiki
Browse files Browse the repository at this point in the history
  • Loading branch information
gac410 committed Sep 10, 2016
1 parent 39ca6a9 commit 3d70439
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
13 changes: 8 additions & 5 deletions lib/Foswiki/Plugins/TestBootstrapPlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ use File::Basename;

use constant TRAUTO => 1;

our $VERSION = '1.0';
our $VERSION = '1.1';

our $RELEASE = '04 Sep 2014';
our $RELEASE = '09 Sep 2016';

# One line description of the module
our $SHORTDESCRIPTION = 'Test foswiki bootstrap code';
Expand Down Expand Up @@ -105,9 +105,12 @@ sub _BOOTSTRAP {

sub _runBootstrap {
local %Foswiki::cfg = ( Engine => $Foswiki::cfg{Engine} );
require Foswiki::Configure::Bootstrap;
my $msg = Foswiki::Configure::Bootstrap::bootstrapConfig();
$msg .= Foswiki::Configure::Bootstrap::bootstrapWebSettings('view');
require Foswiki::Plugins::TestBootstrapPlugin::Bootstrap;
my $msg =
Foswiki::Plugins::TestBootstrapPlugin::Bootstrap::bootstrapConfig();
$msg .=
Foswiki::Plugins::TestBootstrapPlugin::Bootstrap::bootstrapWebSettings(
'view');

return ( \%Foswiki::cfg, $msg );
}
Expand Down
17 changes: 14 additions & 3 deletions lib/Foswiki/Plugins/TestBootstrapPlugin/Bootstrap.pm
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,12 @@ sub _bootstrapStoreSettings {
# Detect the NFC / NDF normalization of the file system, and set
# NFCNormalizeFilenames if needed.
# SMELL: Really this should be done per web, both in data and pub.
my $nfcok =
Foswiki::Configure::FileUtil::canNfcFilenames( $Foswiki::cfg{DataDir} );
my $nfcok;
if ( Foswiki::Configure::FileUtil->can('canNfcFilenames') ) {
$nfcok =
Foswiki::Configure::FileUtil::canNfcFilenames(
$Foswiki::cfg{DataDir} );
}
if ( defined $nfcok && $nfcok == 1 ) {
print STDERR "AUTOCONFIG: Data Storage allows NFC filenames\n"
if (TRAUTO);
Expand Down Expand Up @@ -557,7 +561,14 @@ sub bootstrapWebSettings {

# This might not work, depending on the websrver config,
# but it's the best we can do
$Foswiki::cfg{PubUrlPath} = "$1/../pub";
my $lslash = rindex( $1, '/' );
if ( $lslash >= 0 ) {
$Foswiki::cfg{PubUrlPath} = $1;
substr( $Foswiki::cfg{PubUrlPath}, $lslash + 1 ) = 'pub';
}
else {
$Foswiki::cfg{PubUrlPath} = "$1/../pub";
}
}
else {
print STDERR "AUTOCONFIG: Building Short URL paths using prefix $pfx \n"
Expand Down
1 change: 1 addition & 0 deletions lib/Foswiki/Plugins/TestBootstrapPlugin/MANIFEST
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
!noci
data/System/TestBootstrapPlugin.txt 0644 Documentation page
lib/Foswiki/Plugins/TestBootstrapPlugin.pm 0444 Perl module
lib/Foswiki/Plugins/TestBootstrapPlugin/Bootstrap.pm 0444 Perl module

0 comments on commit 3d70439

Please sign in to comment.