Skip to content

Commit

Permalink
Item12180: Update diagnostic to allow exception for forks of configure
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@16429 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
TimotheLitt authored and TimotheLitt committed Jan 21, 2013
1 parent 348c525 commit 3570510
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/bin/configure
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ our $VERSION = '3.0_001';
sub log;

END {
if ( exists $INC{'Foswiki.pm'} ) {
if ( exists $INC{'Foswiki.pm'} && !$Foswiki::configureFork ) {
my $message =
"Foswiki ERROR: Some module loaded Foswiki.pm into configure. This is not permitted, and will cause unpredictable results, including corruption of the Foswiki configuration. This is probably caused by a pluggable module, such as a checker, pluggable, or Foswiki Engine code that was inappropriately used (use, require) in configure. This must be tracked-down and removed.\n";
print STDERR $message;
Expand Down
3 changes: 3 additions & 0 deletions core/lib/Foswiki/Configure.pm
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ our $FALSE = 0;
# under configure or the webserver. Set by Dispatch.
our $configureRunning;

# Running in a fork of configure - safe to load Foswiki engine
our $configureFork;

# auth - authentication state
our ( $newLogin, $session, );

Expand Down
1 change: 1 addition & 0 deletions core/lib/Foswiki/Configure/Checkers/CGISetup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ HERE
}
else {
$Foswiki::cfg{ConfigurationFinished} = 1;
$Foswiki::configureFork = 1;
eval 'require Foswiki';
if ($@) {
$mess = $@;
Expand Down
1 change: 1 addition & 0 deletions core/lib/Foswiki/Configure/Checkers/EMAILADDRESS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ sub provideFeedback {
close $fh;
}
else {
$Foswiki::configureFork = 1;
eval { print $this->_mailFork($keys); };
print $@ if ($@);
exit(0);
Expand Down
1 change: 1 addition & 0 deletions core/lib/Foswiki/Configure/UIs/EXTEND.pm
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ sub install {
close $fh;
}
else {
$Foswiki::configureFork = 1;
eval { print _installFork(@_); };
print $@ if ($@);
exit(0);
Expand Down
1 change: 1 addition & 0 deletions core/lib/Foswiki/Configure/UIs/EXTENSIONS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ sub _getBuildStrings {
close $fh;
}
else {
$Foswiki::configureFork = 1;
eval {
require Foswiki;
require Foswiki::Plugins;
Expand Down

0 comments on commit 3570510

Please sign in to comment.