Tags:
create new tag
, view all tags

Implemented: PLUGINVERSION Variable

The %PLUGINVERSION{}% variable returns the $TWiki::Plugins::VERSION number if no parameter is specified, or the version number of a named Plugin. If the Plugin cannot be found or is not active, 0 is returned.

The %PLUGINVERSION{"AnyPluginName"}% can be used for conditional rendering based on a Plugin version. This can be done for example with the $IF() function of the SpreadSheetPlugin.

Examples:

You type Sample output Renders as
%PLUGINVERSION{}% 1.025 1.2
%PLUGINVERSION{"EmptyPlugin"}% 0 0
%PLUGINVERSION{"DefaultPlugin"}% 1.021 0
%PLUGINVERSION{"SpreadSheetPlugin"}% 1.013 $Rev: 17911 (30 Mar 2009) $
%PLUGINVERSION{"TablePlugin"}% 1.013 $Rev: 17769 (30 Mar 2009) $

Contributors:
-- PeterThoeny - 14 Aug 2004
-- MartinCleaver - 09 Aug 2004

Discussions

Would be useful for $TWiki::Plugins::VERSION to be visible through the wiki - TWikiReleaseTrackerPlugin has to otherwise get the user to specify manually.

-- MartinCleaver - 09 Aug 2004

Useful, yes, and simple to do.

What is a good variable name? I do not want to pollute the TWiki variable namespace too much. How about a generic TWiki system variable that eventually understands several options? That is also better for performance since the system variable needs to be evaluated just once. Examples:

  • %TWIKISYSTEM{"$pluginsversion"}% -- returns version number of $TWiki::Plugins::VERSION
  • %TWIKISYSTEM{"$twikiversion"}% -- returns what %WIKIVERSION% contains; the latter being retired as an deprecated and undocumented variable
  • %TWIKISYSTEM{"$serveros"}% -- returns the server OS
  • %TWIKISYSTEM{"TWiki version $twikiversion: Plugins API versions: $pluginsversion"}% -- can be combined

Feedback?

-- PeterThoeny - 10 Aug 2004

Hmm, on the other hand, once we have ContentAccessSyntax in place, %TWIKISYSTEM{}% is kind of obsolete. So just for this need here, should we add a %PLUGINVERSION%, which returns $TWiki::Plugins::VERSION?

-- PeterThoeny - 11 Aug 2004

This discussion started in TWikiDistributionVariable.

I changed the syntax to %PLUGINVERSION{}% and added support to query the version of installed Plugins.

Feature is implemented; in SVN; and documented in TWikiVariables.

-- PeterThoeny - 14 Aug 2004

 
Topic revision: r1 - 2004-08-14 - 05:03:17 - PeterThoeny
 
TWIKI.NET
This site is powered by the TWiki collaboration platform
Ideas, requests, problems regarding TWiki? Send feedback
Copyright © 1999-2009 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.