Item14533: PublishPlugin: enableplugins parameter does not work
Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
The documented parameter "enableplugins" does not seem to do anything.
--
StefanH - 20 Nov 2017
There are 4 issues
- enableplugins is not processed correctly, and is processed too early, before the {opt} hash is loaded
- It refers to {opts} instead of {opt} in one place
- When it re-initialises plugins, it fails to check the Enabled flag
- And it calls initPlugin with the wrong Installed web name. (Item14534)
Patch to fix enableplugins
diff --git a/lib/Foswiki/Plugins/PublishPlugin/Publisher.pm b/lib/Foswiki/Plugins/PublishPlugin/Publisher.pm
index 4c4084f..91e12fd 100644
--- a/lib/Foswiki/Plugins/PublishPlugin/Publisher.pm
+++ b/lib/Foswiki/Plugins/PublishPlugin/Publisher.pm
@@ -372,8 +372,12 @@ sub publish {
# NEWTOPICLINKSYMBOL LINKTOOLTIPINFO
$Foswiki::Plugins::SESSION->renderer()->{NEWLINKSYMBOL} = '';
+ $this->logInfo( "*Publisher:* ", Foswiki::Func::getWikiName() );
+ $this->logInfo( "*Date:* ", Foswiki::Func::formatTime( time() ) );
+ $this->_loadParams($params);
+
# Handle =enableplugins=. We simply muddy-boots the foswiki config.
- if ( $this->{opts}->{enableplugins} ) {
+ if ( $this->{opt}->{enableplugins} ) {
# Make a map of plugins known to =configure=
my %state = map { $_ => $Foswiki::cfg{Plugins}{$_}{Enabled} }
@@ -403,10 +407,6 @@ sub publish {
}
}
- $this->logInfo( "*Publisher:* ", Foswiki::Func::getWikiName() );
- $this->logInfo( "*Date:* ", Foswiki::Func::formatTime( time() ) );
- $this->_loadParams($params);
-
$this->{opt}->{publishskin} ||=
Foswiki::Func::getPreferencesValue('PUBLISHSKIN')
|| 'basic_publish';
@@ -755,13 +755,14 @@ sub _publishTopic {
foreach my $plugin ( %{ $Foswiki::cfg{Plugins} } ) {
next
unless ref( $Foswiki::cfg{Plugins}{$plugin} )
- && $Foswiki::cfg{Plugins}{$plugin}{Module};
+ && $Foswiki::cfg{Plugins}{$plugin}{Module}
+ && $Foswiki::cfg{Plugins}{$plugin}{Enabled};
my $module = $Foswiki::cfg{Plugins}{$plugin}{Module};
my $initfn = $module . '::initPlugin';
if ( defined &$initfn ) {
eval {
no strict 'refs';
- &$initfn( $topic, $web, Foswiki::Func::getWikiName(), $web );
+ &$initfn( $topic, $web, Foswiki::Func::getWikiName(), $Foswiki::cfg{SystemWebName} );
use strict 'refs';
};
}
--
GeorgeClark - 20 Nov 2017