Motivation
At the CERN TWiki, the
Plugins.VarCachePlugin is used to cache heavy topics.
When
VarCache is outdated or not in use, some instances of %SEARCH{...}% (
VarSEARCH) and %TREEVIEW{...}% (
TreePlugin) are so heavy that loading them would lead to web server timeout.
We created the
RunTopicsAddOn for our TWiki, and it is used in several cron jobs to tick / refresh resource-heavy topics utilizing functionality like
VarSEARCH and
TreePlugin.
The motivation for this feature request is to discuss the description of this add-on, and to uncover whether:
- The functionality already is available elsewhere.
- If the add-on could do things differently.
Description and Documentation
The add-on consists of three files:
- A documentation topic in
/data/TWiki/RunTopicsAddOn.txt
- A Contrib module in
/lib/TWiki/Contrib/RunTopicsAddOn.pm
- A tool in
/tools/runtopics
To use the add-on, the absolute path to the folder containing TWiki executables is defined in
configure or directly in
lib/LocalSite.cfg:
$TWiki::cfg{RunTopicsAddon}{ScriptPath} = '/path/to/twiki/bin';
The add-on supports three parameters;
- (Mandatory)
webs: A list of webs
- (Mandatory)
topics: A list of topics
- (Optional) A template topic
Examples
Given that
$TWiki::cfg{RunTopicsAddon}{ScriptPath} is set to
/var/www/twiki/bin, consider the following examples:
Example 1) Run 'view' on the TestTopic topic on CMS and Atlas webs. If CMS.TestTopic or Atlas.TestTopic does not exist, skip running view on it.
perl -I /var/www/twiki/bin/ /var/www/twiki/tools/runtopics webs=CMS,Atlas topics=TestTopic
Example 2) Run 'view' on the FooBar topic in all webs, creating it with by cloning Main.MyTopic if it does not exist:
perl -I /var/www/twiki/bin/ /var/www/twiki/tools/runtopics webs=all topics=FooBar Main.MyTopic
Impact
Implementation
--
Contributors:
Terje Ness Andersen - 2014-05-19
Discussion
Thank you Terje for sharing this with the community! Since this is an extension you do not need to go through the feature proposal. Simply package the add-on and release it in the Plugins web. See
AddOnPackageHowTo.
FYI, the
$TWiki::cfg{RunTopicsAddon}{ScriptPath} setting might not be needed if you change to
twiki/bin first, then call
../tools/runtopics. See for example install docs at
WatchlistPlugin
--
Peter Thoeny - 2014-05-19
Thank you for the tip, the configure is not needed if standing directory is the bin/ directory as you say.
Following
BuildContrib, I uploaded the add-on to
http://twiki.org/cgi-bin/view/Plugins/RunTopicsAddOn
.
--
Terje Ness Andersen - 2014-05-19
Nice! Thanks for contributing!!
--
Peter Thoeny - 2014-05-20
I changed the status to
ImplementedAsExtension.
--
Peter Thoeny - 2014-06-05