Welcome, Registration, and other StartingPoints; TWiki history & Wiki style; All the docs...
View   r27  >  r26  >  r25  >  r24  >  r23  >  r22  ...
TWikiPlugins 27 - 18 May 2004 - Main.PeterThoeny
Line: 1 to 1
 

TWiki Plugins

Line: 59 to 59
 
  • Method 2: List the Plugin being tested in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Sandbox web and do the testing there.
Added:
>
>

Checking that Plugins are Working on a Live Server

InstalledPlugins shows which Plugins are: 1) installed, 2) loading properly and 3) what TWiki:Codev.PluginHandlers they invoke. Any failures are shown in the Errors section.

 

A Note on Plugin Performance

The performance of the system depends on the number of Plugins installed and on the Plugin implementation. Some Plugins impose no measurable performance decrease, some do. For example, outsidePREHandler is an expensive callback function, or a Plugin might use many Perl libraries that need to be initialized with each page view (unless you run mod_perl). It is recommended to measure the performance with and without a new Plugin. Example for Unix:
time wget -qO /dev/null http://moglen.law.columbia.edu/twiki/bin/view/TWiki/AbcPlugin

Line: 301 to 305
 }
Changed:
<
<
-- TWiki:Main/PeterThoeny - 11 Dec 2003
-- TWiki:Main/AndreaSterbini - 29 May 2001
>
>
-- TWiki:Main/PeterThoeny - 18 May 2004
-- TWiki:Main/AndreaSterbini - 29 May 2001
 -- TWiki:Main/MikeMannix - 03 Dec 2001
Added:
>
>

TWikiPlugins 26 - 15 Dec 2003 - Main.PeterThoeny
Line: 1 to 1
 

TWiki Plugins

Line: 204 to 204
 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!>"
Changed:
<
<
Plugin Global Settings: <Description and settings for custom Plugin %VARIABLES%, and those required by TWiki.>"
>
>
Plugin Settings: <Description and settings for custom Plugin %VARIABLES%, and those required by TWiki.>"
 
  • Plugins Preferences <If user settings are needed, explain... Entering values works exactly like TWikiPreferences and WebPreferences: six (6) spaces and then:>"
    • Set <EXAMPLE = value added>
Line: 231 to 231
 

Publishing for Public Use

Changed:
<
<
You can release your tested, packaged Plugin to the TWiki community through the TWiki:Plugins web. All Plugins submitted to TWiki.org are available for download and further development in TWiki:Plugins. Publish your Plugin in three steps:
>
>
You can release your tested, packaged Plugin to the TWiki community through the TWiki:Plugins web. All Plugins submitted to TWiki.org are available for download and further development in TWiki:Plugins/PluginPackage. Publish your Plugin in these steps:
 
Changed:
<
<
  1. Post the Plugin documentation topic in the TWiki:Plugins web:
    • create a new topic using the Plugin name, ex: MyFirstPlugin.txt
>
>
  1. Post the Plugin documentation topic in the TWiki:Plugins/PluginPackage:
    • enter the Plugin name in the "How to Create a Plugin" section, for example MyFirstPlugin
 
  1. Attach the distribution zip file to the topic, ex: MyFirstPlugin.zip
  2. Link from the doc page to a new, blank page named after the Plugin, and ending in Dev, ex: MyFirstPluginDev. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)
Added:
>
>
  1. Put the Plugin into the CVS repository, see TWiki:Plugins/ReadmeFirst (optional)
 
Changed:
<
<
-- AndreaSterbini? - 29 May 2001
-- PeterThoeny - 11 Dec 2003
-- MikeMannix? - 03 Dec 2001
>
>
Thank you very much for sharing your Plugin with the TWiki community smile

Recommended Storage of Plugin Data

Plugins sometimes need to store data. This can be Plugin internal data like cache data, or generated data for the browser like images. The following is a recommendation where to store the data.

Where to store Plugin Internal Data

In case the Plugin generates data just for internal use, or data which is not specific to a topic, store it in the Plugin's attachment directory.

  • The Plugin's attachment directory is pubdir/Installweb/FooBarPlugin
    • Installweb refers to the name of the web where the Plugin is installed
  • The Plugin's attachment URL is %PUBURL%/Installweb/FooBarPlugin
  • The filename should start with an underscore, followed by an identifier, e.g. _any_name.ext
    • The leading underscore avoids a nameclash with files attached to the Plugin topic
    • Use only alphanumeric characters, underscores and periods to avoid platform dependency issues and URL issues
    • Do not use subdirectories (rename and delete would fail)
  • Use Plugin API functions documented in TWikiFuncModule? to ensure portability:
    • Use getPubDir() to get the attachment root directory
    • Use getUrlHost() and getPubUrlPath() to build the URL in case you create content for the browser
    • Use $installWeb to get the name of the web where the Plugin is installed
    • Create the web directory and topic attachment directory if needed
  • Hint: Package the Plugin at least with one file attachment. This ensures that the attachment directory already exists

Where to Store Data for Topics using the Plugin

In case the Plugin generates data which is specific to a topic, store it in the topic's attachment directory.

  • The topic's attachment directory is pubdir/Webname/TopicName
  • The topic's attachment URL is %PUBURL%/Webname/TopicName
  • The filename should start with an underscore, followed by the Plugin name, an underscore and an identifier, e.g. _FooBarPlugin_any_name.ext
    • The leading underscore avoids a nameclash with files attached to the same topic
    • Use only alphanumeric characters, underscores and periods to avoid platform dependency issues and URL issues
    • Do not use subdirectories (rename and delete would fail)
  • Use Plugin API functions documented in TWikiFuncModule? to ensure portability:
    • Use getPubDir() to get the attachment root directory
    • Use getUrlHost() and getPubUrlPath() to build the URL in case you create content for the browser

Example code to build the file name:

sub _make_filename
{
    my ( $web, $topic, $name ) = @_;

    # Create web directory "pub/$web" if needed
    my $dir = TWiki::Func::getPubDir() . "/$web";
    unless( -e "$dir" ) {
        umask( 002 );
        mkdir( $dir, 0775 );
    }
    # Create topic directory "pub/$web/$topic" if needed
    $dir .= "/$topic";
    unless( -e "$dir" ) {
        umask( 002 );
        mkdir( $dir, 0775 );
    }
    return "$dir/_FooBarPlugin_$name";
}

-- TWiki:Main/PeterThoeny - 11 Dec 2003
-- TWiki:Main/AndreaSterbini - 29 May 2001
-- TWiki:Main/MikeMannix - 03 Dec 2001


TWikiPlugins 25 - 12 Dec 2003 - Main.PeterThoeny
Line: 1 to 1
 

TWiki Plugins

Line: 17 to 17
 

Preinstalled Plugins

Changed:
<
<
TWiki comes with three Plugins as part of the standard installation.
>
>
TWiki comes with a set of Plugins as part of the standard installation.
 
Changed:
<
<
  • DefaultPlugin? optionally handles some legacy variables from older versions of TWiki. You can control this option from TWikiPreferences. (Perl programmers can also add rules for simple custom processing.)

  • EmptyPlugin is a fully functional module, minus active code; it does nothing and serves as a template for new Plugin development.

  • InterwikiPlugin is preinstalled but can be disabled or removed. Use it for shorthand linking to remote sites, ex: TWiki:Plugins expands to TWiki:Plugins on TWiki.org. You can edit the predefined set of of Wiki-related sites, and add your own.
>
>
  • DefaultPlugin? : Optionally handles some legacy variables from older versions of TWiki. You can control this option from TWikiPreferences. (Perl programmers can also add rules for simple custom processing.)
  • EmptyPlugin: Is a fully functional module, minus active code; it does nothing and serves as a template for new Plugin development.
  • InterwikiPlugin: Use it for shorthand linking to remote sites, ex: TWiki:Plugins expands to TWiki:Plugins on TWiki.org. You can edit the predefined set of of Wiki-related sites, and add your own.
  • EditTablePlugin: Edit TWiki tables using edit fields, date pickers and drop down boxes
  • RenderListPlugin: Render bullet lists in a variety of formats
  • SlideShowPlugin: Create web based presentations based on topics with headings.
  • SmiliesPlugin: Render smilies as icons, like smile for  :-) or eek! for  :eek:
  • SpreadSheetPlugin: Add spreadsheet calculation like "$SUM( $ABOVE() )" to TWiki tables and other topic text
  • TablePlugin: Control attributes of tables and sorting of table columns
 

Installing Plugins

Line: 55 to 59
 
  • Method 2: List the Plugin being tested in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Sandbox web and do the testing there.
Changed:
<
<

A Note on Performance

>
>

A Note on Plugin Performance

 
Changed:
<
<
The performance of the system depends on the number of Plugins installed and on the Plugin implementation. Some Plugins impose no measurable performance decrease, some do. For example, outsidePREHandler is an expensive callback function, or a Plugin might use many Perl libraries that needs to be initialized with each page view (unless you run mod_perl). It is recommended to measure the performance with and without a new Plugin. Example for Unix:
time wget -qO /dev/null http://moglen.law.columbia.edu/twiki/bin/view/TWiki/AbcPlugin
>
>
The performance of the system depends on the number of Plugins installed and on the Plugin implementation. Some Plugins impose no measurable performance decrease, some do. For example, outsidePREHandler is an expensive callback function, or a Plugin might use many Perl libraries that need to be initialized with each page view (unless you run mod_perl). It is recommended to measure the performance with and without a new Plugin. Example for Unix:
time wget -qO /dev/null http://moglen.law.columbia.edu/twiki/bin/view/TWiki/AbcPlugin
 In case you need to install an "expensive" Plugin and you need its functionality only in one web you can place the Plugin topic into that web. TWiki will initialize the Plugin only if the Plugin topic is found (which won't be the case for other webs.)
Line: 117 to 121
 
  • All but the initPlugin are disabled. To enable a call back, remove DISABLE_ from the function name.
  • For best performance, enable only the functions you really need. NOTE: outsidePREHandler and insidePREHandler are particularly expensive.
Added:
>
>
Most Plugins use either the commonTagsHandler or startRenderingHandler for rendering tasks:
  • commonTagsHandler: Use it to expand %XYZPLUGIN% and %XYZPLUGIN{...}% variables
  • startRenderingHandler: Use it for your own rendering rules or to overload TWiki's internal rendering like [[links]]

TWiki:Codev/StepByStepRenderingOrder helps you decide which rendering handler to use.

Hints on Writing Fast Plugins

  • Delay the Plugin initialization to the actual function which is handling the tag. This way all the expensive initialization is done only when needed.
  • For example, use an eval block like:
    eval { require IPC::Run }
    return "<font color=\"red\">SamplePlugin: Can't load required modules ($@)</font>" if $@;
  • You could return errors as strings to show what happened
  • You can use a flag to avoid running the initialization twice
 

Plugin Version Detection

To eliminate the incompatibility problems bound to arise from active open Plugin development, a Plugin versioning system and an API GetVersion detection routine are provided for automatic compatibility checking.

Line: 221 to 240
 
  1. Link from the doc page to a new, blank page named after the Plugin, and ending in Dev, ex: MyFirstPluginDev. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)

-- AndreaSterbini? - 29 May 2001

Changed:
<
<
-- PeterThoeny - 29 Jan 2003
>
>
-- PeterThoeny - 11 Dec 2003
 -- MikeMannix? - 03 Dec 2001

TWikiPlugins 24 - 01 Aug 2003 - Main.PeterThoeny
Line: 1 to 1
 

TWiki Plugins

Line: 57 to 57
 

A Note on Performance

Changed:
<
<
The performance of the system depends on the number of Plugins installed and on the Plugin implementation. Some Plugins impose no measurable performance decrease, some do. For example, outsidePREHandler is an expensive callback function, or a Plugin might use many Perl libraries that needs to be initialized with each page view (unless you run mod_perl). It is recommended to measure the performance with and without a new Plugin.
>
>
The performance of the system depends on the number of Plugins installed and on the Plugin implementation. Some Plugins impose no measurable performance decrease, some do. For example, outsidePREHandler is an expensive callback function, or a Plugin might use many Perl libraries that needs to be initialized with each page view (unless you run mod_perl). It is recommended to measure the performance with and without a new Plugin. Example for Unix:
time wget -qO /dev/null http://moglen.law.columbia.edu/twiki/bin/view/TWiki/AbcPlugin
 In case you need to install an "expensive" Plugin and you need its functionality only in one web you can place the Plugin topic into that web. TWiki will initialize the Plugin only if the Plugin topic is found (which won't be the case for other webs.)

TWikiPlugins 23 - 01 Aug 2003 - Main.PeterThoeny
Line: 1 to 1
 

TWiki Plugins

Line: 55 to 55
 
  • Method 2: List the Plugin being tested in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Sandbox web and do the testing there.
Added:
>
>

A Note on Performance

The performance of the system depends on the number of Plugins installed and on the Plugin implementation. Some Plugins impose no measurable performance decrease, some do. For example, outsidePREHandler is an expensive callback function, or a Plugin might use many Perl libraries that needs to be initialized with each page view (unless you run mod_perl). It is recommended to measure the performance with and without a new Plugin.

In case you need to install an "expensive" Plugin and you need its functionality only in one web you can place the Plugin topic into that web. TWiki will initialize the Plugin only if the Plugin topic is found (which won't be the case for other webs.)

 

Managing Plugins

When you finish installing a Plugin, you should be able to read the user instructions and go. In fact, some Plugins require additional settings or offer extra options that you have to select. Also, you may want to make a Plugin available only in certain webs, or temporarily disable it. And may want to list all available Plugins in certain topics. You can handle all of these management tasks with simple procedures.


Revision 27r27 - 18 May 2004 - 06:49:22 - PeterThoeny?
Revision 26r26 - 15 Dec 2003 - 07:23:36 - PeterThoeny?
Revision 25r25 - 12 Dec 2003 - 07:57:00 - PeterThoeny?
Revision 24r24 - 01 Aug 2003 - 07:53:49 - PeterThoeny?
Revision 23r23 - 01 Aug 2003 - 05:37:04 - PeterThoeny?
Revision 22r22 - 28 Feb 2003 - 04:32:00 - PeterThoeny?
This site is powered by the TWiki collaboration platform.
All material on this collaboration platform is the property of the contributing authors.
All material marked as authored by Eben Moglen is available under the license terms CC-BY-SA version 4.
Syndicate this site RSSATOM