yum
, apt-get
, rpm
, etc) to install dependent libraries.
If available, install CPAN (Comprehensive Perl Archive Network) libraries with the OS package manager. For example, to install IO::Socket::SSL
on Fedora/RedHat/CentOS, run yum install perl-IO-Socket-SSL
. CPAN modules can also be installed natively, see TWiki:TWiki.HowToInstallCpanModules.
%FAILEDPLUGINS%
variable can be used to debug failures. You may also want to check your webserver error log and the various TWiki log files.
ab
utility. Example on Unix:time wget -qO /dev/null /bin/view/System/AbcPlugin
DISABLEDPLUGINS
to be a comma-separated list of names of plugins to disable. Define it in Main.TWikiPreferences to disable those plugins everywhere, in the WebPreferences topic to disable them in an individual web, or in a topic to disable them in that topic. For example,
* Set DISABLEDPLUGINS = SpreadSheetPlugin, EditTablePlugin
{PluginsOrder}
in the plugins section of configure.
Set VARCACHEPLUGIN_REFRESH = 24
%<pluginname>_<setting>%
, such as %VARCACHEPLUGIN_REFRESH%
.
To learn how this is done, use the TWiki:Plugins.VarCachePlugin documentation and Perl plugin code as a reference.
2. Use configure settings:
The administrator can set plugin settings in the configure interface. Recommended if only site administrators should be able to change settings. Chose this option to set sensitive or dangerous system settings, such as passwords or path to executables. To define plugin-specific configure settings,
lib/TWiki/Plugins/YourPlugin/
with variables, such as$TWiki::cfg{Plugins}{RecentVisitorPlugin}{ShowIP} = 0;
$showIP = $TWiki::cfg{Plugins}{RecentVisitorPlugin}{ShowIP} || 0;
Set SHORTDESCRIPTION = Show recent visitors to a TWiki site
our $SHORTDESCRIPTION = 'Show recent visitors to a TWiki site';
our $NO_PREFS_IN_TOPIC = 1;
%ACTIVATEDPLUGINS%
%PLUGINDESCRIPTIONS%
configure
interface using json-rpc %FAILEDPLUGINS%
Plugin | Errors |
---|---|
TWikiCompatibilityPlugin | none |
SpreadSheetPlugin | none |
SlideShowPlugin | none |
AutoViewTemplatePlugin | none |
BreadCrumbsPlugin | none |
CommentPlugin | none |
CompareRevisionsAddonPlugin | none |
ConfigurePlugin | none |
DBCachePlugin | none |
DiffPlugin | none |
EditRowPlugin | none |
FilterPlugin | none |
FlexFormPlugin | none |
FlexWebListPlugin | none |
GridLayoutPlugin | none |
HistoryPlugin | none |
HomePagePlugin | none |
ImagePlugin |
Foswiki::Plugins::ImagePlugin could not be loaded. Errors were: Can't locate Image/Magick.pm in @INC (you may need to install the Image::Magick module) (@INC contains: /home/runcloud/webapps/FosWiki-CS/lib /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base /home/runcloud/webapps/FosWiki-CS/lib/CPAN/lib) at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin/Core.pm line 49. at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin/Core.pm line 49. Foswiki::Plugins::ImagePlugin::Core::BEGIN() called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin/Core.pm line 49 eval {...} called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin/Core.pm line 49 require Foswiki/Plugins/ImagePlugin/Core.pm called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin.pm line 41 Foswiki::Plugins::ImagePlugin::BEGIN() called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin/Core.pm line 49 eval {...} called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin/Core.pm line 49 require Foswiki/Plugins/ImagePlugin.pm called at (eval 102) line 1 Foswiki::Plugin::BEGIN() called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin/Core.pm line 49 eval {...} called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin/Core.pm line 49 eval 'use Foswiki::Plugins::ImagePlugin' called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugin.pm line 108 Foswiki::Plugin::new("Foswiki::Plugin", Foswiki=HASH(0x5599e4124490), "ImagePlugin") called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins.pm line 198 Foswiki::Plugins::preload(Foswiki::Plugins=HASH(0x5599e41246d0)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins.pm line 85 Foswiki::Plugins::new("Foswiki::Plugins", Foswiki=HASH(0x5599e4124490)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki.pm line 2106 Foswiki::new("Foswiki", undef, Foswiki::Request=HASH(0x5599e36d6690), HASH(0x5599e388e958)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 366 Foswiki::UI::__ANON__() called at /usr/share/perl5/Error.pm line 465 eval {...} called at /usr/share/perl5/Error.pm line 454 Error::subs::try(CODE(0x5599e2e0df10), HASH(0x5599e4123fe0)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 506 Foswiki::UI::_execute(Foswiki::Request=HASH(0x5599e36d6690), CODE(0x5599e2e0e060), "view", 1) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 327 Foswiki::UI::handleRequest(Foswiki::Request=HASH(0x5599e36d6690)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Engine/CGI.pm line 100 Foswiki::Engine::CGI::run(Foswiki::Engine::CGI=HASH(0x5599e3936e08)) called at /home/runcloud/webapps/FosWiki-CS//bin/view line 30 BEGIN failed--compilation aborted at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin/Core.pm line 49. at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin/Core.pm line 49. require Foswiki/Plugins/ImagePlugin/Core.pm called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin.pm line 41 Foswiki::Plugins::ImagePlugin::BEGIN() called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin/Core.pm line 49 eval {...} called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin/Core.pm line 49 require Foswiki/Plugins/ImagePlugin.pm called at (eval 102) line 1 Foswiki::Plugin::BEGIN() called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin/Core.pm line 49 eval {...} called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin/Core.pm line 49 eval 'use Foswiki::Plugins::ImagePlugin' called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugin.pm line 108 Foswiki::Plugin::new("Foswiki::Plugin", Foswiki=HASH(0x5599e4124490), "ImagePlugin") called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins.pm line 198 Foswiki::Plugins::preload(Foswiki::Plugins=HASH(0x5599e41246d0)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins.pm line 85 Foswiki::Plugins::new("Foswiki::Plugins", Foswiki=HASH(0x5599e4124490)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki.pm line 2106 Foswiki::new("Foswiki", undef, Foswiki::Request=HASH(0x5599e36d6690), HASH(0x5599e388e958)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 366 Foswiki::UI::__ANON__() called at /usr/share/perl5/Error.pm line 465 eval {...} called at /usr/share/perl5/Error.pm line 454 Error::subs::try(CODE(0x5599e2e0df10), HASH(0x5599e4123fe0)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 506 Foswiki::UI::_execute(Foswiki::Request=HASH(0x5599e36d6690), CODE(0x5599e2e0e060), "view", 1) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 327 Foswiki::UI::handleRequest(Foswiki::Request=HASH(0x5599e36d6690)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Engine/CGI.pm line 100 Foswiki::Engine::CGI::run(Foswiki::Engine::CGI=HASH(0x5599e3936e08)) called at /home/runcloud/webapps/FosWiki-CS//bin/view line 30 Compilation failed in require at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin.pm line 41. at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin.pm line 41. Foswiki::Plugins::ImagePlugin::BEGIN() called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin.pm line 41 eval {...} called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin.pm line 41 require Foswiki/Plugins/ImagePlugin.pm called at (eval 102) line 1 Foswiki::Plugin::BEGIN() called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin.pm line 41 eval {...} called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin.pm line 41 eval 'use Foswiki::Plugins::ImagePlugin' called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugin.pm line 108 Foswiki::Plugin::new("Foswiki::Plugin", Foswiki=HASH(0x5599e4124490), "ImagePlugin") called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins.pm line 198 Foswiki::Plugins::preload(Foswiki::Plugins=HASH(0x5599e41246d0)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins.pm line 85 Foswiki::Plugins::new("Foswiki::Plugins", Foswiki=HASH(0x5599e4124490)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki.pm line 2106 Foswiki::new("Foswiki", undef, Foswiki::Request=HASH(0x5599e36d6690), HASH(0x5599e388e958)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 366 Foswiki::UI::__ANON__() called at /usr/share/perl5/Error.pm line 465 eval {...} called at /usr/share/perl5/Error.pm line 454 Error::subs::try(CODE(0x5599e2e0df10), HASH(0x5599e4123fe0)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 506 Foswiki::UI::_execute(Foswiki::Request=HASH(0x5599e36d6690), CODE(0x5599e2e0e060), "view", 1) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 327 Foswiki::UI::handleRequest(Foswiki::Request=HASH(0x5599e36d6690)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Engine/CGI.pm line 100 Foswiki::Engine::CGI::run(Foswiki::Engine::CGI=HASH(0x5599e3936e08)) called at /home/runcloud/webapps/FosWiki-CS//bin/view line 30 BEGIN failed--compilation aborted at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin.pm line 41. at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin.pm line 41. require Foswiki/Plugins/ImagePlugin.pm called at (eval 102) line 1 Foswiki::Plugin::BEGIN() called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin.pm line 41 eval {...} called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins/ImagePlugin.pm line 41 eval 'use Foswiki::Plugins::ImagePlugin' called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugin.pm line 108 Foswiki::Plugin::new("Foswiki::Plugin", Foswiki=HASH(0x5599e4124490), "ImagePlugin") called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins.pm line 198 Foswiki::Plugins::preload(Foswiki::Plugins=HASH(0x5599e41246d0)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins.pm line 85 Foswiki::Plugins::new("Foswiki::Plugins", Foswiki=HASH(0x5599e4124490)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki.pm line 2106 Foswiki::new("Foswiki", undef, Foswiki::Request=HASH(0x5599e36d6690), HASH(0x5599e388e958)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 366 Foswiki::UI::__ANON__() called at /usr/share/perl5/Error.pm line 465 eval {...} called at /usr/share/perl5/Error.pm line 454 Error::subs::try(CODE(0x5599e2e0df10), HASH(0x5599e4123fe0)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 506 Foswiki::UI::_execute(Foswiki::Request=HASH(0x5599e36d6690), CODE(0x5599e2e0e060), "view", 1) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 327 Foswiki::UI::handleRequest(Foswiki::Request=HASH(0x5599e36d6690)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Engine/CGI.pm line 100 Foswiki::Engine::CGI::run(Foswiki::Engine::CGI=HASH(0x5599e3936e08)) called at /home/runcloud/webapps/FosWiki-CS//bin/view line 30 Compilation failed in require at (eval 102) line 1. at (eval 102) line 1. Foswiki::Plugin::BEGIN() called at (eval 102) line 1 eval {...} called at (eval 102) line 1 eval 'use Foswiki::Plugins::ImagePlugin' called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugin.pm line 108 Foswiki::Plugin::new("Foswiki::Plugin", Foswiki=HASH(0x5599e4124490), "ImagePlugin") called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins.pm line 198 Foswiki::Plugins::preload(Foswiki::Plugins=HASH(0x5599e41246d0)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins.pm line 85 Foswiki::Plugins::new("Foswiki::Plugins", Foswiki=HASH(0x5599e4124490)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki.pm line 2106 Foswiki::new("Foswiki", undef, Foswiki::Request=HASH(0x5599e36d6690), HASH(0x5599e388e958)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 366 Foswiki::UI::__ANON__() called at /usr/share/perl5/Error.pm line 465 eval {...} called at /usr/share/perl5/Error.pm line 454 Error::subs::try(CODE(0x5599e2e0df10), HASH(0x5599e4123fe0)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 506 Foswiki::UI::_execute(Foswiki::Request=HASH(0x5599e36d6690), CODE(0x5599e2e0e060), "view", 1) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 327 Foswiki::UI::handleRequest(Foswiki::Request=HASH(0x5599e36d6690)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Engine/CGI.pm line 100 Foswiki::Engine::CGI::run(Foswiki::Engine::CGI=HASH(0x5599e3936e08)) called at /home/runcloud/webapps/FosWiki-CS//bin/view line 30 BEGIN failed--compilation aborted at (eval 102) line 1. at (eval 102) line 1. eval 'use Foswiki::Plugins::ImagePlugin' called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugin.pm line 108 Foswiki::Plugin::new("Foswiki::Plugin", Foswiki=HASH(0x5599e4124490), "ImagePlugin") called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins.pm line 198 Foswiki::Plugins::preload(Foswiki::Plugins=HASH(0x5599e41246d0)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Plugins.pm line 85 Foswiki::Plugins::new("Foswiki::Plugins", Foswiki=HASH(0x5599e4124490)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki.pm line 2106 Foswiki::new("Foswiki", undef, Foswiki::Request=HASH(0x5599e36d6690), HASH(0x5599e388e958)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 366 Foswiki::UI::__ANON__() called at /usr/share/perl5/Error.pm line 465 eval {...} called at /usr/share/perl5/Error.pm line 454 Error::subs::try(CODE(0x5599e2e0df10), HASH(0x5599e4123fe0)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 506 Foswiki::UI::_execute(Foswiki::Request=HASH(0x5599e36d6690), CODE(0x5599e2e0e060), "view", 1) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/UI.pm line 327 Foswiki::UI::handleRequest(Foswiki::Request=HASH(0x5599e36d6690)) called at /home/runcloud/webapps/FosWiki-CS/lib/Foswiki/Engine/CGI.pm line 100 Foswiki::Engine::CGI::run(Foswiki::Engine::CGI=HASH(0x5599e3936e08)) called at /home/runcloud/webapps/FosWiki-CS//bin/view line 30 ---- |
InterwikiPlugin | none |
JQueryPlugin | none |
ListyPlugin | none |
MailerContribPlugin | none |
MimeIconPlugin | none |
MoreFormfieldsPlugin | none |
MultiLingualPlugin | none |
NatEditPlugin | none |
NatSkinPlugin | none |
PreferencesPlugin | none |
RedDotPlugin | none |
RenderListPlugin | none |
RenderPlugin | none |
SmiliesPlugin | none |
SubscribePlugin | none |
TablePlugin | none |
TagMePlugin | none |
TinyMCEPlugin | none |
TopicInteractionPlugin | none |
TopicTitlePlugin | none |
TwistyPlugin | none |
UpdatesPlugin | none |
WebCreatorPlugin | none |
WebLinkPlugin | none |
WysiwygPlugin | none |
Handler | Plugins |
---|---|
afterAttachmentSaveHandler | DBCachePlugin This handler is deprecated - please check for updated versions of the plugins that use it! |
afterUploadHandler | DBCachePlugin MoreFormfieldsPlugin TopicInteractionPlugin |
afterCommonTagsHandler | TablePlugin TopicInteractionPlugin |
afterEditHandler | MoreFormfieldsPlugin WysiwygPlugin |
afterRenameHandler | DBCachePlugin FlexWebListPlugin MoreFormfieldsPlugin TopicTitlePlugin |
afterSaveHandler | DBCachePlugin FlexWebListPlugin MoreFormfieldsPlugin TagMePlugin |
beforeCommonTagsHandler | NatSkinPlugin PreferencesPlugin WysiwygPlugin |
beforeEditHandler | MoreFormfieldsPlugin NatEditPlugin TinyMCEPlugin WysiwygPlugin |
beforeMergeHandler | WysiwygPlugin |
beforeSaveHandler | MoreFormfieldsPlugin MultiLingualPlugin TopicTitlePlugin WysiwygPlugin |
beforeUploadHandler | TopicInteractionPlugin |
commonTagsHandler | SpreadSheetPlugin SlideShowPlugin CompareRevisionsAddonPlugin DiffPlugin EditRowPlugin FilterPlugin |
completePageHandler | FlexFormPlugin NatSkinPlugin |
earlyInitPlugin | TWikiCompatibilityPlugin |
endRenderingHandler | NatSkinPlugin This handler is deprecated - please check for updated versions of the plugins that use it! |
finishPlugin | BreadCrumbsPlugin DBCachePlugin DiffPlugin FilterPlugin FlexFormPlugin FlexWebListPlugin GridLayoutPlugin JQueryPlugin ListyPlugin MimeIconPlugin MoreFormfieldsPlugin MultiLingualPlugin NatSkinPlugin RenderPlugin TopicInteractionPlugin TopicTitlePlugin UpdatesPlugin WebCreatorPlugin WebLinkPlugin |
initPlugin | TWikiCompatibilityPlugin SpreadSheetPlugin SlideShowPlugin AutoViewTemplatePlugin BreadCrumbsPlugin CommentPlugin CompareRevisionsAddonPlugin ConfigurePlugin DBCachePlugin DiffPlugin EditRowPlugin FilterPlugin FlexFormPlugin FlexWebListPlugin GridLayoutPlugin HistoryPlugin HomePagePlugin InterwikiPlugin JQueryPlugin ListyPlugin MailerContribPlugin MimeIconPlugin MoreFormfieldsPlugin MultiLingualPlugin NatEditPlugin NatSkinPlugin PreferencesPlugin RedDotPlugin RenderListPlugin RenderPlugin SmiliesPlugin SubscribePlugin TablePlugin TagMePlugin TinyMCEPlugin TopicInteractionPlugin TopicTitlePlugin TwistyPlugin UpdatesPlugin WebCreatorPlugin WebLinkPlugin WysiwygPlugin |
initializeUserHandler | HomePagePlugin |
lateInitPlugin | JQueryPlugin |
modifyHeaderHandler | RenderPlugin WysiwygPlugin |
postRenderingHandler | EditRowPlugin PreferencesPlugin WysiwygPlugin |
preRenderingHandler | InterwikiPlugin RenderListPlugin SmiliesPlugin TablePlugin |
renderWikiWordHandler | TWikiCompatibilityPlugin TopicTitlePlugin |
lib/TWiki/Func.pm
) describes all the interfaces available to plugins. Plugins should only use the interfaces described in this module.
Func.pm
, you run the risk of creating security holes. Also, your plugin will likely break and require updating when you upgrade to a new version of TWiki.
lib/TWiki/Plugins/EmptyPlugin.pm
module.
#
from all lines of the callback.
eval
block like this:eval { require IPC::Run }
return "<font color=\"red\">SamplePlugin: Can't load required modules ($@)</font>" if $@;
lib/TWiki/Plugins/BathPlugin/
.
$NO_PREFS_IN_TOPIC
in your plugin package as that will stop TWiki from reading the plugin topic for every page. Use Config.spec or preferences settings instead. (See details).
$VERSION
variable. This should be an integer, or a subversion version id.
initPlugin
handler should check all dependencies and return 1 if the initialization is OK or 0 if something went wrong. initPlugin
handler).
$TWiki::Plugins::VERSION
in the TWiki::Plugins
module contains the TWiki plugin API version, currently 2.5. %PLUGINVERSION{}%
variable to query the plugin API version or the version of installed plugins.
%TWiki::cfg
hash than adding it as preferences in the plugin topic. configure
describes the steps
MyFirstPlugin.pm
MyFirstPlugin.txt
MyFirstPlugin
topic. Other needed Perl code is best placed in a lib/TWiki/Plugins/MyFirstPlugin/
directory.
The plugin API handles the details of connecting your Perl module with main TWiki code. When you're familiar with the Plugin API, you're ready to develop plugins.
The TWiki:Plugins.BuildContrib module provides a lot of support for plugins development, including a plugin creator, automatic publishing support, and automatic installation script writer. If you plan on writing more than one plugin, you probably need it.
lib/TWiki/Plugins/EmptyPlugin.pm
to <name>Plugin.pm
. The EmptyPlugin.pm
module contains mostly empty functions, so it does nothing, but it's ready to be used. Customize it. Refer to the Plugin API specs for more information.
If your plugin uses its own modules and objects, you must include the name of the plugin in the package name. For example, write Package MyFirstPlugin::Attrs;
instead of just Package Attrs;
. Then call it using:
use TWiki::Plugins::MyFirstPlugin::Attrs; $var = MyFirstPlugin::Attrs->new();
MyFirstPlugin
, press enter and create the new topic
OUTLINE: Doc Topic Contents
Check the plugins web on TWiki.org for the latest plugin doc topic template. Here's a quick overview of what's covered: Syntax Rules: <Describe any special text formatting that will be rendered.>" Example: <Include an example of the plugin in action. Possibly include a static HTML version of the example to compare if the installation was a success!>" Plugin Settings: <Description and settings for custom plugin %VARIABLES%, and those required by TWiki.>" Plugin Installation Instructions: <Step-by-step set-up guide, user help, whatever it takes to install and run, goes here.>" Plugin Info: <Version, credits, history, requirements - entered in a form, displayed as a table. Both are automatically generated when you create or edit a page in the TWiki:Plugins web.>"
Plugin
, ex: MyFirstPlugin.pm
, and a documentation page with the same name(MyFirstPlugin.txt
).
lib/TWiki/Plugins/MyFirstPlugin.pm
data/TWiki/MyFirstPlugin.txt
pub/TWiki/MyFirstPlugin/uparrow.gif
[a required graphic]
MyFirstPlugin.zip
) and add the entire directory structure from Step 1. The archive should look like this: lib/TWiki/Plugins/MyFirstPlugin.pm
data/TWiki/MyFirstPlugin.txt
pub/TWiki/MyFirstPlugin/uparrow.gif
MyFirstPlugin
MyFirstPlugin.zip
Dev
, ex: MyFirstPluginDev
. This is the discussion page for future development. (User support for plugins is handled in TWiki:Support.)
TWiki::Func::getWorkArea()
function, which gives you a persistent directory where you can store data files. By default they will not be web accessible. The directory is guaranteed to exist, and to be writable by the webserver user. For convenience, TWiki::Func::storeFile()
and TWiki::Func::readFile()
are provided to persistently store and retrieve simple data in this area.
TWiki::Func::saveAttachment()
function to store the data.
Recommendation for file name: _GaugePlugin_img123.gif
TWiki::Func::saveAttachment()
function to store the data.
Recommendation for file names in plugin attachment area: _Main_roundedge-ul.gif
configure
configure
rather than trying to use TWiki preferences variables. These extensions use Config.spec
files to publish their configuration requirements.
Config.spec
files are read during TWiki configuration. Once a Config.spec
has defined a configuration item, it is available for edit through the standard configure
interface. Config.spec
files are stored in the 'plugin directory' e.g. lib/TWiki/Plugins/BathPlugin/Config.spec
.
Config.spec
file Config.spec
file for an extension starts with the extension announcing what it is:
# ---+ Extensions # ---++ BathPlugin # This plugin senses the level of water in your bath, and ensures the plug # is not removed while the water is still warm.This is followed by one or more configuration items. Each configuration item has a type, a description and a default. For example:
# **SELECT Plastic,Rubber,Metal** # Select the plug type $TWiki::cfg{BathPlugin}{PlugType} = 'Plastic'; # **NUMBER** # Enter the chain length in cm $TWiki::cfg{BathPlugin}{ChainLength} = 30; # **BOOLEAN EXPERT** # Set this option to 0 to disable the water temperature alarm $TWiki::cfg{BathPlugin}{TempSensorEnabled} = 1;The type (e.g.
**SELECT**
) tells configure
to how to prompt for the value. It also tells configure
how to do some basic checking on the value you actually enter. All the comments between the type and the configuration item are taken as part of the description. The configuration item itself defines the default value for the configuration item. The above spec defines the configuration items $TWiki::cfg{BathPlugin}{PlugType}
, $TWiki::cfg{BathPlugin}{ChainLength}
, and $TWiki::cfg{BathPlugin}{TempSensorEnabled}
for use in your plugin. For example,
if( $TWiki::cfg{BathPlugin}{TempSensorEnabled} && $curTemperature > 50 ) { die "The bathwater is too hot for comfort"; }The Config.spec file is read by
configure
, which then writes LocalSite.cfg
with the values chosen by the local site admin.
A range of types are available for use in Config.spec
files:
BOOLEAN | A true/false value, represented as a checkbox |
COMMAND length | A shell command |
LANGUAGE | A language (selected from {LocalesDir} |
NUMBER | A number |
OCTAL | An octal number |
PASSWORD length | A password (input is hidden) |
PATH length | A file path |
PERL | A perl structure, consisting of arrays and hashes |
REGEX length | A perl regular expression |
SELECT choices | Pick one of a range of choices |
SELECTCLASS root | Select a perl package (class) |
STRING length | A string |
URL length | A url |
URLPATH length | A relative URL path |
EXPERT | means this an expert option |
M | means the setting is mandatory (may not be empty) |
H | means the option is not visible in configure |
lib/TWiki.spec
for many more examples.
Config.spec
files for non-plugin extensions are stored under the Contrib
directory instead of the Plugins
directory.
Note that from TWiki 5.0 onwards, CGI scripts (in the TWiki bin
directory) provided by extensions must also have an entry in the Config.spec
file. This entry looks like this (example taken from PublishContrib)
# **PERL H** # Bin script registration - do not modify $TWiki::cfg{SwitchBoard}{publish} = [ "TWiki::Contrib::Publish", "publish", { publishing => 1 } ];
PERL
specifies a perl data structure, and H
a hidden setting (it won't appear in configure
). The first field of the data value specifies the class where the function that implements the script can be found. The second field specifies the name of the function, which must be the same as the name of the script. The third parameter is a hash of initial context settings for the script.
TWiki:TWiki/SpecifyingConfigurationItemsForExtensions has supplemental documentation on configure settings.
Dev
, such as MyFirstPluginDev
. The plugin development topic is a great resource to discuss feature enhancements and to get feedback from the TWiki community.
if( $TWiki::Plugins::VERSION >= 1.1 ) { @webs = TWiki::Func::getListOfWebs( 'user,public' ); } else { @webs = TWiki::Func::getPublicWebList( ); }
TWiki::Plugins
version in which the handler was first deprecated. For example, if we need to define the endRenderingHandler
for compatibility with TWiki::Plugins
versions before 1.1, we would add this to the plugin:
package TWiki::Plugins::SinkPlugin; use vars qw( %TWikiCompatibility ); $TWikiCompatibility{endRenderingHandler} = 1.1;If the currently-running TWiki version is 1.1 or later, then the handler will not be called and the warning will not be issued. TWiki with versions of
TWiki::Plugins
before 1.1 will still call the handler as required.
Related Topics: DeveloperDocumentationCategory, AdminDocumentationCategory, TWiki:TWiki.TWikiPluginsSupplement
-- Contributors: TWiki:Main.PeterThoeny, TWiki:Main.AndreaSterbini, TWiki:Main.MikeMannix, TWiki:Main.CrawfordCurrie, TWiki:Main.ArthurClemens, TWiki:Main.WillNorris