Difference: TWikiScripts (1 vs. 16)

Revision 162015-07-07 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 8 to 8
 
Added:
>
>
 

CGI Scripts

Details on CGI scripts located in the twiki/bin directory.

Added:
>
>
 

General Information

Added:
>
>
 

CGI environment

In the CGI environment parameters are passed to the scripts via the URL and URL parameters. Environment variables are also used to determine the user performing the action. If the environment is not set up, the default TWiki user is used (usually guest).

Added:
>
>
 

Command-line

You must have the twiki/bin directory on the perl path to run the scripts from the command line. To avoid issues with file permissions, run the scripts as the web server user such as nobody or www.

Line: 25 to 29
 Parameters are passed on the command line using '-name' - for example,
$ cd /usr/local/twiki/bin
Changed:
<
<
$ save -topic MyTopic -user admin -action save -text "New text of the topic"
>
>
$ save -topic MyTopic -user admin -method POST -action save -text "New text of the topic"
  All parameters require a value, even if that is the empty string.
Added:
>
>
 

Common parameters

All the scripts accept a number of common parameters. The first two components of the URL after the script name are taken as the web and the topic, respectively. Standard URL parameters are:

Parameter Description Default
topic If this is set to a URL, TWiki will immediately redirect to that URL. Otherwise it overrides the URL and is taken as the topic name (you can pass Web.TopicName)  
Changed:
<
<
user Command-line only; set the name of the user performing the action. Note: this usage is inherently insecure, as it bypasses webserver login constraints. For this reason only authorized users should be allowed to execute scripts from the command line.  
>
>
user Command-line only; set the name of the user performing the action. Note: this usage is inherently insecure, as it bypasses webserver login constraints. For this reason only authorized users should be allowed to execute scripts from the command line. TWikiAdminGroup
method Commad-line only; set the HTTP request method. Some scripts requires the POST method under certain circumstances. In such a case, you need to specify the POST method to run the script from a command line. GET
 
skin Overrides the default skin path (see TWikiSkins)  
cover Specifies temporary skin path to prepend to the skin path for this script only (see TWikiSkins)  
Added:
>
>
 

attach

Despite the name, this script doesn't actually attach a file to a topic - for that, use upload. This script is part of the transactions sequence executed when a file is uploaded from the browser. it just generates the "new attachment" page for a topic.

Line: 46 to 53
 
Parameter Description Default
filename Name of existing attachment (if provided, this is a "manage attachment" action) none (in which case this is a "new attachment" action)
Added:
>
>
 

changes

Shows all the changes in the given web.

Line: 59 to 67
  Note: The result from changes script and the topic WebChanges can be different, if the changes file is deleted from a web. In particular, in new installations the changes script will return no results while the WebChanges topic will.
Added:
>
>
 

configure

configure is the browser script used for inspection and configuration of the TWiki configuration. None of the parameters to this script are useable for any purpose except configure. See configure.

Added:
>
>
 

edit

The edit script understands the following parameters, typically supplied by HTML input fields:

Line: 87 to 97
  Note: Most skins support the definition of EDIT_SKIN, which is used as the value of the cover parameter in edit URLs. This allows you to override the default edit skin on a web, topic or user basis.
Added:
>
>
 

login

Used for logging in when TWiki login is being used (e.g TemplateLoginManager).

Line: 95 to 106
 
username username of user logging in none
password password of user logging in none
Added:
>
>
 

logon

Used for logging in when Web Server authentication is being used (e.g. ApacheLoginManager). The script does nothing; it is purely a placeholder for triggering the login process. The webserver will be set up to require a valid user to access this script, thus triggering the webserver login process.

Added:
>
>
 

manage

Performs a range of management functions.

Line: 107 to 120
  Note: The manage script can only be called via http POST method for createweb renameweb, and deleteUserAccount.
Added:
>
>
 

action=createweb

Parameter Description Default
Line: 116 to 130
 
sitemapwhat Value for SITEMAPWHAT ''
nosearchall Value for NOSEARCHALL ''
Added:
>
>
 

action=renameweb

Parameter Description Default
Line: 123 to 138
 
newparentweb New parent web name ''
confirm If defined, requires a second level of confirmation. Supported values are "getlock", "continue", and "cancel" ''
Added:
>
>
 

action=editSettings

No parameters

Added:
>
>
 

action=saveSettings

Parameter Description Default
Line: 135 to 152
 
redirectto If the savesettings process is successful, save will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Security setup > Miscellaneous {AllowRedirectUrl}).
All other parameters may be interpreted as form fields, depending on the current form definition in the topic.
Added:
>
>
 

action=bulkRegister

See BulkRegistration.

Line: 143 to 161
 
EmailUsersWithDetails Whether to mail registered users or not false
LogTopic Topic to save the log in Same as topic name, with 'Result' appended.
Added:
>
>
 

action=changePassword

Change password, email address, or both, of a user.

Line: 154 to 173
 
email new email address none
password, =passwordA and email are optional. If neither or password and passwordA is set, then the user password is left unchanged. If email is unset, their email is left unchanged.
Added:
>
>
 

action=resetPassword

Reset the password for a single or multiple users

Line: 165 to 185
  BulkRegistration provides the means to create multiple accounts but it does not announce those accounts to the users who own them. BulkResetPassword is used to assign the passwords, the Introduction is used to explain why they are receiving the mail.
Added:
>
>
 

action=deleteUserAccount

Unregisters (removes) the currently logged-in user.

Parameter Description Default
password Users' password none
Added:
>
>
 

oops

This script is mainly used for rendering pages containing error messages, though it is also used for some functional actions such as manage pages (move topic etc).

Line: 184 to 206
 
def Optional, can be set to the name of a single definition within template. This definition will be instantiated in the template wherever %INSTANTIATE% is seen. This lets you use a single template file for many messages. For an example, see oopsmanagebad.tmpl.  
paramN Where N is an integer from 1 upwards. These values will be substituted into template for %PARAM1% etc.  
Added:
>
>
 

preview

This script is deprecated. Its functions are covered by the save script.

Added:
>
>
 

rdiff

Renders the differences between version of a TWiki topic

Line: 201 to 225
 TODO:
  • add a {word} render style
Added:
>
>
 

register

Parameter Description Default
Line: 209 to 234
  Note: The register script can only be called via http POST method, not GET. Make sure to specify the "post" method if you call the register script via a form action.
Added:
>
>
 

rename

Used for renaming topics and attachments.

Line: 227 to 253
  Note: The rename script can only be called via http POST method, not GET. Make sure you specify method="post" if you call the rename script via a form action.
Added:
>
>
 

copy

Used for copying the current topic in its entirety including its history and attachments.

Line: 239 to 266
 
overwrite By default, copy does not happen if the destination topic already exists. If this parameter is 'on', the destination topic is deleted if exists before copying takes place off (no overwrite)
disablefixlinks Bypass fixing WikiWord links in the copy destination topic if copy is done across webs. Fixing links in the copied topic such as from SomeLink to Otherweb.SomeLink is usually desirable so that links in the copied topic still point to the same target off (links are fixed)
Added:
>
>
 

mdrepo

Used to retrieve and update data in MetadataRepository. Please read MetadataRepository#mdrepo_script_from_command_line and MetadataRepository#mdrepo_script_from_browser.

Added:
>
>
 

rest

This REST (Representational State Transfer) script can be invoked via http in the same way as the other TWiki scripts (see Invocation Examples, below) to execute a function that is associated to a "subject" and a "verb" (see below). These functions are usually registered by plugins using the TWiki::Func::registerRESTHandler method. The rest script will print the result directly to the browser unless the endPoint parameter is specified, in which case it will output a redirect to the given topic.

Line: 274 to 303
  Note that for Plugins to register REST handlers, they must be enabled in configure.
Added:
>
>
 

save

The save script performs a range of save-related functions, as selected by the action parameter.

Line: 332 to 362
  It is not possible to call save from an <a href=""> link.
Added:
>
>
 

search

CGI gateway to the %SEARCH% functionality driven by the following CGI parameters:

Line: 339 to 370
 
Parameter: Description: Default:
"text" Search term. Is a keyword search, literal search or regular expression search, depending on the type parameter. SearchHelp has more required
search="text" (Alternative to above) N/A
Changed:
<
<
web="Name"
web="Main, Know"
web="all"
Comma-separated list of webs to search. See TWikiVariables#VarSEARCH for more details. Current web
>
>
web="Name"
web="Main, Know"
web="all"
Comma-separated list of webs to search. See VarSEARCH for more details. Current web
 
topic="WebPreferences"
topic="*Bug"
Limit search to topics: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. All topics in a web
excludetopic="Web*"
excludetopic="WebHome, WebChanges"
Exclude topics from search: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. None
type="keyword"
type="literal"
type="regex"
Do a keyword search like soap "web service" -shampoo; a literal search like web service; or RegularExpression search like soap;web service;!shampoo %SEARCHVAR- DEFAULTTYPE% preferences setting (literal)
Line: 363 to 394
 
nofinalnewline="on" If on, the search variable does not end in a line by itself. Any text continuing immediately after the search tag on the same line will be rendered as part of the table generated by the search, if appropriate. off
separator=", " Line separator between hits Newline "$n"
Added:
>
>
 

statistics

Refresh the WebStatistics topics in range of webs.

Line: 381 to 413
  See TWikiSiteTools#WebStatistics_site_statistics for updating statistics using cron.
Added:
>
>
 

upload

Uploads an attachment to a topic. The HTTP request is expected to be in multipart/form-data format.

Parameter Description Default
Changed:
<
<
hidefile if defined, will not show file in attachment table  
filepath local (client) path name of the file being uploaded. This is used to look up the data for the file in the HTTP query.  
filename deprecated, do not use  
>
>
hidefile If defined, will not show file in attachment table  
filepath Local (client) path name of the file being uploaded. This is used to look up the data for the file in the HTTP query.  
filename Deprecated, do not use  
 
filecomment Comment to associate with file in attachment table  
Changed:
<
<
createlink if defined, will create a link to file at end of topic  
changeproperties if defined, this is a property change operation only - no file will be uploaded. null
updatefield If defined and if the value matches the name of a form field, it will update that form field with the name of the uploaded file.  
>
>
createlink If defined, will create a link to file at end of topic  
changeproperties If defined, this is a property change operation only - no file will be uploaded. null
updatefield If defined and if the value matches the name of a form field, it will update that form field with the format defined by the updateformat parameter.  
updateformat Format of the value of the form field indicated by the updatefield parameter. The default is the name of the attached file, but can be set to include more, such as the path to the image, %PUBURL%/%BASEWEB%/%BASETOPIC%/$filename. $filename
  You can use a tool like curl to upload files from the command line using this script.

ALERT! Note: The upload script can only be called via http POST method, not GET.

Added:
>
>
 

view

Used for viewing topics.

Line: 424 to 459
 which shows the topic as plain text; useful for those who want to download plain text for the topic. Using skin=text this way is DEPRECATED, use raw=text instead.
Added:
>
>
 

viewfile

Used for viewing attachments. Normally, a site will publish the attachments (pub) directory using a URL. However if it contains sensitive information, you will want to protect attachments using TWikiAccessControls. In this case, you can use the viewfile script to give access to attachments while still checking access controls.

Line: 431 to 467
 
Parameter Description Default
filename name of attachment  
rev Revision to view  
Added:
>
>
debug Put debug info to the debug log  
  Instead of using the filename parameter, you can append the attachment name to the end of the URL path (after the topic) e.g. https://afnog.iotworkshop.africa/do/viewfile/Webname/TopicName/Attachment.gif
Added:
>
>
In that case, determining the attachment file name is non-trivial -- please consider a file name having multiple dots and a file name having no dots. As such, the process of determining the file name is put on the debug log if debug=1 URL parameter is supplied.
 
Added:
>
>
 

Command Line Scripts

Details on command line scripts located in the twiki/tools directory.

Added:
>
>
 

geturl.pl

This is a very simple script to get the content of a web site. It is marked as deprecated and might be removed (or enhanced) in a future TWiki release. Its functions are covered by the standard wget and curl commands.

Line: 446 to 487
 
  • Example: geturl.pl some.domain /some/dir/file.html 80
  • Will get: http://some.domain:80/some/dir/file.html
Added:
>
>
 

rewriteshebang.pl

Simple script to rewrite the #!/usr/bin/perl shebang lines specific to your local Perl installation. It will rewrite the first line of all your TWiki cgi scripts so they use a different shebang line. Use it if your perl is in a non-standard location, or you want to use a different interpreter (such as 'speedy').

Added:
>
>
 

tick_twiki.pl

Added:
>
>
 This script executes a number of non-essential regular administration tasks that will help keep your TWiki healthy and happy, such as removing expired sessions and lease files.

It is intended to be run as a cron job or a scheduled task once a week. Example crontab entry:

Revision 152014-04-04 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 75 to 75
 
text Initial text for the topic  
topicparent The parent topic  
formtemplate Name of the form to instantiate in the topic. Overrides the form set in the templatetopic if defined. (will remove the form is set to 'none')  
Added:
>
>
template Specify a different skin template, overriding the 'edit' template the edit script would normally use. Use this for specialized templates in a TWiki Application. This parameter is not commonly used.  
 
contenttype Optional parameter that defines the application type to write into the CGI header. Defaults to text/html. May be used to invoke alternative client applications  
anyname Any parameter can passed to the new topic; if the template topic contains %URLPARAM{"anyname"}%, it will be replaced by its value  
breaklock If set, any lease conflicts will be ignored, and the edit will proceed even if someone is already editing the topic.  

Revision 142013-09-25 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 35 to 35
 
Parameter Description Default
topic If this is set to a URL, TWiki will immediately redirect to that URL. Otherwise it overrides the URL and is taken as the topic name (you can pass Web.TopicName)  
Changed:
<
<
user Command-line only; set the name of the user performing the action. Note: this usage is inherently insecure, as it bypasses webserver login constraints. For this reason only authorised users should be allowed to execute scripts from the command line.  
>
>
user Command-line only; set the name of the user performing the action. Note: this usage is inherently insecure, as it bypasses webserver login constraints. For this reason only authorized users should be allowed to execute scripts from the command line.  
 
skin Overrides the default skin path (see TWikiSkins)  
cover Specifies temporary skin path to prepend to the skin path for this script only (see TWikiSkins)  
Line: 174 to 174
  This script is mainly used for rendering pages containing error messages, though it is also used for some functional actions such as manage pages (move topic etc).
Changed:
<
<
oops templates are used with the oops script to generate system messages. This is done to make internationalisation or other local customisations simple.
>
>
oops templates are used with the oops script to generate system messages. This is done to make internationalization or other local customizations simple.
  The oops script supports the following parameters:
Line: 222 to 222
 
currentwebonly if defined, searches current web only for links to this topic  
nonwikiword if defined, a non-wikiword is acceptable for the new topic name  
redirectto If the rename process is successful, rename will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Security setup > Miscellaneous {AllowRedirectUrl}).
 
Added:
>
>
disablefixlinks Bypass fixing WikiWord links in the rename destination topic if rename is done across webs. Fixing links in the renamed topic such as from SomeLink to Otherweb.SomeLink is usually desirable so that links in the copied topic still point to the same target off (links are fixed)
  Note: The rename script can only be called via http POST method, not GET. Make sure you specify method="post" if you call the rename script via a form action.
Added:
>
>

copy

Used for copying the current topic in its entirety including its history and attachments.

Parameter Description Default
newweb destination web name current web
newtopic destination topic name current topic
nonwikiword if defined, a non-wikiword is acceptable for the destination topic name  
redirectto If the copy process is successful, copy will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Security setup > Miscellaneous {AllowRedirectUrl}).
 
overwrite By default, copy does not happen if the destination topic already exists. If this parameter is 'on', the destination topic is deleted if exists before copying takes place off (no overwrite)
disablefixlinks Bypass fixing WikiWord links in the copy destination topic if copy is done across webs. Fixing links in the copied topic such as from SomeLink to Otherweb.SomeLink is usually desirable so that links in the copied topic still point to the same target off (links are fixed)

mdrepo

Used to retrieve and update data in MetadataRepository. Please read MetadataRepository#mdrepo_script_from_command_line and MetadataRepository#mdrepo_script_from_browser.

 

rest

This REST (Representational State Transfer) script can be invoked via http in the same way as the other TWiki scripts (see Invocation Examples, below) to execute a function that is associated to a "subject" and a "verb" (see below). These functions are usually registered by plugins using the TWiki::Func::registerRESTHandler method. The rest script will print the result directly to the browser unless the endPoint parameter is specified, in which case it will output a redirect to the given topic.

Line: 325 to 343
 
excludetopic="Web*"
excludetopic="WebHome, WebChanges"
Exclude topics from search: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. None
type="keyword"
type="literal"
type="regex"
Do a keyword search like soap "web service" -shampoo; a literal search like web service; or RegularExpression search like soap;web service;!shampoo %SEARCHVAR- DEFAULTTYPE% preferences setting (literal)
scope="topic"
scope="text"
scope="all"
Search topic name (title); the text (body) of topic; or all (both) "text"
Changed:
<
<
order="topic"
order="created"
order="modified"
order="editby"
order=
 "formfield(name)"
Sort the results of search by the topic names, topic creation time, last modified time, last editor, or named field of TWikiForms. The sorting is done web by web; in case you want to sort across webs, create a formatted table and sort it with TablePlugin's initsort Sort by topic name
limit="all"
limit="16"
Limit the number of results returned. This is done after sorting if order is specified All results
>
>
sort="topic"
sort="created"
sort="modified"
sort="editby"
sort="parent"
sort=
 "formfield(name)"
Sort the results of search by the topic names, topic creation time, last modified time, last editor, parent topic name, or named field of TWikiForms. The sorting is done web by web; in case you want to sort across webs, create a formatted table and sort it with TablePlugin's initsort Sort by topic name
limit="all"
limit="16"
Limit the number of results returned. This is done after sorting if sort is specified All results
 
date="..." limits the results to those pages with latest edit time in the given time interval. All results
reverse="on" Reverse the direction of the search Ascending search
casesensitive="on" Case sensitive search Ignore case
Line: 387 to 405
 
raw=on Shows the text of the topic in a scrollable textarea  
raw=debug As raw=on, but also shows the metadata (forms etc) associated with the topic.  
raw=text Shows only the source of the topic, as plain text (Content-type: text/plain). Only shows the body text, not the form or other meta-data.
Added:
>
>
raw=expandvariables Similar to raw=text but TWiki variables are expanded.  
 
raw=all Shows only the source of the topic, as plain text (Content-type: text/plain), with embedded meta-data. This may be useful if you want to extract the source of a topic to a local file on disc.  
section Allows to view only a part of the topic delimited by a named section (see VarSTARTSECTION). If the given section is not present, no topic content is displayed.  
contenttype Allows you to specify a different Content-Type: (e.g. contenttype=text/plain)  
rev Revision to view (e.g. rev=45)  
Changed:
<
<
template Allows you to specify a different skin template, overriding the 'view' template the view script would normally use. The default template is view. For example, you could specify /do/view/TWiki/TWikiScripts?template=edit. This is mainly useful when you have specialised templates for a TWiki Application.  
>
>
template Allows you to specify a different skin template, overriding the 'view' template the view script would normally use. The default template is view. For example, you could specify /do/view/TWiki/TWikiScripts?template=edit. This is mainly useful when you have specialized templates for a TWiki Application.  
 
topic redirects to show the specified Web.Topic, or, redirects to a URL, if allowed by {AllowRedirectUrl} and {PermittedRedirectHostUrls} configure settings  
createifnotexist If createifnotexist is set to 1 and in case the topic does not exist, it is created automatically on view. Useful to create topics automatically based on a specific template (see example below). Behind the scene, the view script redirects first to the save script, passing along all URL parameters. Thus all URL parameters of the save script can be used, such as templatetopic, topicparent and redirectto. Next, the save script creates the topic and redirects back to the view script (or displays an error in case there were any issues creating the topic).  
extralog Add additional text to TWiki log, next to the user agent string. Useful to log actions by cache scripts and crawlers.  

Revision 132012-12-28 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 394 to 394
 
template Allows you to specify a different skin template, overriding the 'view' template the view script would normally use. The default template is view. For example, you could specify /do/view/TWiki/TWikiScripts?template=edit. This is mainly useful when you have specialised templates for a TWiki Application.  
topic redirects to show the specified Web.Topic, or, redirects to a URL, if allowed by {AllowRedirectUrl} and {PermittedRedirectHostUrls} configure settings  
createifnotexist If createifnotexist is set to 1 and in case the topic does not exist, it is created automatically on view. Useful to create topics automatically based on a specific template (see example below). Behind the scene, the view script redirects first to the save script, passing along all URL parameters. Thus all URL parameters of the save script can be used, such as templatetopic, topicparent and redirectto. Next, the save script creates the topic and redirects back to the view script (or displays an error in case there were any issues creating the topic).  
Added:
>
>
extralog Add additional text to TWiki log, next to the user agent string. Useful to log actions by cache scripts and crawlers.  
  TIP Example use of createifnotexist to link to the bookmark page of a user, and to create the page on the fly if needed:
[[%SCRIPTURL{view}%/%USERSWEB%/%WIKINAME%Bookmarks?createifnotexist=1&amp;templatetopic=%SYSTEMWEB%.UserBookmarksTemplate&amp;topicparent=%WIKINAME%][Bookmarks]]

Revision 122012-05-16 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 20 to 20
 

Command-line

Changed:
<
<
You must be have the twiki/bin directory on the perl path to run the scripts from the command line. To avoid issues with file permissions, run the scripts as the web server user such as nobody or www.
>
>
You must have the twiki/bin directory on the perl path to run the scripts from the command line. To avoid issues with file permissions, run the scripts as the web server user such as nobody or www.
  Parameters are passed on the command line using '-name' - for example,
Line: 78 to 78
 
contenttype Optional parameter that defines the application type to write into the CGI header. Defaults to text/html. May be used to invoke alternative client applications  
anyname Any parameter can passed to the new topic; if the template topic contains %URLPARAM{"anyname"}%, it will be replaced by its value  
breaklock If set, any lease conflicts will be ignored, and the edit will proceed even if someone is already editing the topic.  
Changed:
<
<
redirectto If the user continues from edit to save, and if the save (or cancels the edit) process is successful, save will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Miscellaneous {AllowRedirectUrl}).
 
>
>
redirectto If the user continues from edit to save, and if the save (or cancels the edit) process is successful, save will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Security setup > Miscellaneous {AllowRedirectUrl}).
 
 
t Provide a unique URL each time a topic is edited, typically specifying parameter t=%SERVERTIME{$epoch}% in an edit link. This is done to prevent browsers from caching an edit session, which could result in editing outdated content. The parameter name and value is arbitrary, but must be unique each time.  

Form field values are passed in parameters named 'field' - for example, if I have a field Status the parameter name is Status.

Line: 131 to 131
 
Parameter Description Default
text Text of the topic ''
originalrev Revision that the edit started on Most recent revision
Changed:
<
<
redirectto If the savesettings process is successful, save will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Miscellaneous {AllowRedirectUrl}).
>
>
redirectto If the savesettings process is successful, save will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Security setup > Miscellaneous {AllowRedirectUrl}).
 All other parameters may be interpreted as form fields, depending on the current form definition in the topic.

action=bulkRegister

Line: 221 to 221
 
confirm if defined, requires a second level of confirmation  
currentwebonly if defined, searches current web only for links to this topic  
nonwikiword if defined, a non-wikiword is acceptable for the new topic name  
Changed:
<
<
redirectto If the rename process is successful, rename will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Miscellaneous {AllowRedirectUrl}).
 
>
>
redirectto If the rename process is successful, rename will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Security setup > Miscellaneous {AllowRedirectUrl}).
 
  Note: The rename script can only be called via http POST method, not GET. Make sure you specify method="post" if you call the rename script via a form action.
Line: 281 to 281
 
originalrev Revision on which the edit started.  
edit The script to use to edit the topic when action is checkpoint edit
editparams The parameter string to use to edit the topic  
Changed:
<
<
redirectto The save process will redirect to this topic or URL if it is successful. (Typically this would be the URL that was being viewed when edit was invoked). The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Miscellaneous {AllowRedirectUrl}).
view topic being edited
>
>
redirectto The save process will redirect to this topic or URL if it is successful. (Typically this would be the URL that was being viewed when edit was invoked). The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Security setup > Miscellaneous {AllowRedirectUrl}).
view topic being edited
  Any errors will cause a redirect to an oops page.

Revision 112011-06-23 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 204 to 204
 
Parameter Description Default
action register or verify or resetPassword or approve  
Changed:
<
<
topicparent The parent topic of the new user homepage {UsersTopicName} configure setting
>
>
topicparent The parent topic of the new user profile page {UsersTopicName} configure setting
  Note: The register script can only be called via http POST method, not GET. Make sure to specify the "post" method if you call the register script via a form action.
Line: 373 to 373
 
filecomment Comment to associate with file in attachment table  
createlink if defined, will create a link to file at end of topic  
changeproperties if defined, this is a property change operation only - no file will be uploaded. null
Added:
>
>
updatefield If defined and if the value matches the name of a form field, it will update that form field with the name of the uploaded file.  
  You can use a tool like curl to upload files from the command line using this script.
Line: 391 to 392
 
contenttype Allows you to specify a different Content-Type: (e.g. contenttype=text/plain)  
rev Revision to view (e.g. rev=45)  
template Allows you to specify a different skin template, overriding the 'view' template the view script would normally use. The default template is view. For example, you could specify /do/view/TWiki/TWikiScripts?template=edit. This is mainly useful when you have specialised templates for a TWiki Application.  
Changed:
<
<
topic redirects (at the beging of the cgi script running) to show the spcified Web.Topic, or, redirects to a URL, if allowed by {AllowRedirectUrl} and {PermittedRedirectHostUrls} configure settings  
>
>
topic redirects to show the specified Web.Topic, or, redirects to a URL, if allowed by {AllowRedirectUrl} and {PermittedRedirectHostUrls} configure settings  
createifnotexist If createifnotexist is set to 1 and in case the topic does not exist, it is created automatically on view. Useful to create topics automatically based on a specific template (see example below). Behind the scene, the view script redirects first to the save script, passing along all URL parameters. Thus all URL parameters of the save script can be used, such as templatetopic, topicparent and redirectto. Next, the save script creates the topic and redirects back to the view script (or displays an error in case there were any issues creating the topic).  
 
Changed:
<
<
ALERT! For historical reasons, the view script has a special interpretation of the text skin. In earlier TWiki versions the skin=text parameter was used like this:
>
>
TIP Example use of createifnotexist to link to the bookmark page of a user, and to create the page on the fly if needed:
[[%SCRIPTURL{view}%/%USERSWEB%/%WIKINAME%Bookmarks?createifnotexist=1&amp;templatetopic=%SYSTEMWEB%.UserBookmarksTemplate&amp;topicparent=%WIKINAME%][Bookmarks]]

ALERT! For historical reasons, the view script has a special interpretation of the text skin. In earlier TWiki versions the skin=text parameter was used like this:

 http://.../view/MyWeb/MyTopic?skin=text&contenttype=text/plain&raw=on which shows the topic as plain text; useful for those who want to download plain text for the topic. Using skin=text this way is DEPRECATED, use raw=text instead.
Line: 434 to 439
  Related Topics: AdminDocumentationCategory, DeveloperDocumentationCategory
Changed:
<
<
-- Contributors: TWiki:Main/ArthurClemens, TWiki:Main/CrawfordCurrie, TWiki:Main/MichaelDaum, TWiki:Main/PeterThoeny, TWiki:Main/RafaelAlvarez, TWiki:Main/SvenDowideit, TWiki:Main/ThomasWeigert, TWiki:Main/WillNorris
>
>
-- Contributors: TWiki:Main.ArthurClemens, TWiki:Main.CrawfordCurrie, TWiki:Main.MichaelDaum, TWiki:Main.PeterThoeny, TWiki:Main.RafaelAlvarez, TWiki:Main.SvenDowideit, TWiki:Main.ThomasWeigert, TWiki:Main.WillNorris

Revision 102010-12-07 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 204 to 204
 
Parameter Description Default
action register or verify or resetPassword or approve  
Added:
>
>
topicparent The parent topic of the new user homepage {UsersTopicName} configure setting
  Note: The register script can only be called via http POST method, not GET. Make sure to specify the "post" method if you call the register script via a form action.
Line: 390 to 391
 
contenttype Allows you to specify a different Content-Type: (e.g. contenttype=text/plain)  
rev Revision to view (e.g. rev=45)  
template Allows you to specify a different skin template, overriding the 'view' template the view script would normally use. The default template is view. For example, you could specify /do/view/TWiki/TWikiScripts?template=edit. This is mainly useful when you have specialised templates for a TWiki Application.  
Changed:
<
<
topic redirects (at the beging of the cgi script running) to show the spcified Web.Topic, or, redirects to a URL, if allowed by {AllowRedirectUrl} and {PermittedRedirectHostUrls}  
>
>
topic redirects (at the beging of the cgi script running) to show the spcified Web.Topic, or, redirects to a URL, if allowed by {AllowRedirectUrl} and {PermittedRedirectHostUrls} configure settings  
  ALERT! For historical reasons, the view script has a special interpretation of the text skin. In earlier TWiki versions the skin=text parameter was used like this: http://.../view/MyWeb/MyTopic?skin=text&contenttype=text/plain&raw=on

Revision 92010-05-06 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 69 to 79
 
anyname Any parameter can passed to the new topic; if the template topic contains %URLPARAM{"anyname"}%, it will be replaced by its value  
breaklock If set, any lease conflicts will be ignored, and the edit will proceed even if someone is already editing the topic.  
redirectto If the user continues from edit to save, and if the save (or cancels the edit) process is successful, save will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Miscellaneous {AllowRedirectUrl}).
 
Added:
>
>
t Provide a unique URL each time a topic is edited, typically specifying parameter t=%SERVERTIME{$epoch}% in an edit link. This is done to prevent browsers from caching an edit session, which could result in editing outdated content. The parameter name and value is arbitrary, but must be unique each time.  
  Form field values are passed in parameters named 'field' - for example, if I have a field Status the parameter name is Status.
  1. The first sequence of ten or more X characters in the topic name will be converted on save to a number such that the resulting topic name is unique in the target web.
Line: 93 to 107
 Note: The manage script can only be called via http POST method for createweb renameweb, and deleteUserAccount.

action=createweb

Added:
>
>
 
Parameter Description Default
newweb Name of the new web ''
baseweb Name of the web to copy to create the new web ''
webbgcolor value for WEBBGCOLOR ''
sitemapwhat Value for SITEMAPWHAT ''
Deleted:
<
<
sitemapuseto Value for SITEMAPUSETO ''
 
nosearchall Value for NOSEARCHALL ''

action=renameweb

Line: 316 to 344
 
separator=", " Line separator between hits Newline "$n"

statistics

Added:
>
>
 Refresh the WebStatistics topics in range of webs.
Added:
>
>
 
Parameter Description Default
webs comma-separated list of webs to run stats on all accessible webs
logdate YYYYMM to generate statistics for current month
Changed:
<
<
for example:
>
>
For example:
 
  1. from browser https://afnog.iotworkshop.africa/do/statistics updates all user webs
  2. from browser https://afnog.iotworkshop.africa/do/statistics?webs=TWiki,Main,Sandbox updates TWiki,Main,Sandbox
  3. from browser https://afnog.iotworkshop.africa/do/statistics/TWiki updates TWiki
Line: 329 to 359
 
  1. from command line twiki/bin/statistics -webs=TWiki,Main,Sandbox updates TWiki,Main,Sandbox
  2. from command line twiki/bin/statistics TWiki.WebHome updates TWiki
Changed:
<
<
see TWikiSiteTools#WebStatistics_site_statistics for updating statistics using cron.
>
>
See TWikiSiteTools#WebStatistics_site_statistics for updating statistics using cron.
 

upload

Added:
>
>
 Uploads an attachment to a topic. The HTTP request is expected to be in multipart/form-data format.
Added:
>
>
 
Parameter Description Default
hidefile if defined, will not show file in attachment table  
filepath local (client) path name of the file being uploaded. This is used to look up the data for the file in the HTTP query.  
Line: 394 to 431
  Note: The script has to be run by a user who can write files created by the webserver user.
Deleted:
<
<
 Related Topics: AdminDocumentationCategory, DeveloperDocumentationCategory
Added:
>
>
-- Contributors: TWiki:Main/ArthurClemens, TWiki:Main/CrawfordCurrie, TWiki:Main/MichaelDaum, TWiki:Main/PeterThoeny, TWiki:Main/RafaelAlvarez, TWiki:Main/SvenDowideit, TWiki:Main/ThomasWeigert, TWiki:Main/WillNorris

Revision 82009-04-21 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 49 to 49
  The main difference between invoking this script and using WebChanges is that WebChanges is based on a %SEARCH%, while this script reads the changes file in each web, making it much faster.
Changed:
<
<
NOTE: The result from changes script and the topic WebChanges can be different, if the changes file is deleted from a web. In particular, in new installations the changes script will return no results while the WebChanges topic will.
>
>
Note: The result from changes script and the topic WebChanges can be different, if the changes file is deleted from a web. In particular, in new installations the changes script will return no results while the WebChanges topic will.
 

configure

configure is the browser script used for inspection and configuration of the TWiki configuration. None of the parameters to this script are useable for any purpose except configure. See configure.
Line: 73 to 73
 Form field values are passed in parameters named 'field' - for example, if I have a field Status the parameter name is Status.
  1. The first sequence of ten or more X characters in the topic name will be converted on save to a number such that the resulting topic name is unique in the target web.
Changed:
<
<
NOTE: most skins support the definition of EDIT_SKIN, which is used as the value of the cover parameter in edit URLs. This allows you to override the default edit skin on a web, topic or user basis.
>
>
Note: Most skins support the definition of EDIT_SKIN, which is used as the value of the cover parameter in edit URLs. This allows you to override the default edit skin on a web, topic or user basis.
 

login

Used for logging in when TWiki login is being used (e.g TemplateLoginManager).
Line: 88 to 88
 

manage

Performs a range of management functions.
Parameter Description Default
Changed:
<
<
action One of createweb, deleteUserAccount, editSettings or saveSettings none
>
>
action One of createweb, renameweb, deleteUserAccount, editSettings or saveSettings none

Note: The manage script can only be called via http POST method for createweb renameweb, and deleteUserAccount.

 

action=createweb

Parameter Description Default
Line: 99 to 101
 
sitemapuseto Value for SITEMAPUSETO ''
nosearchall Value for NOSEARCHALL ''
Added:
>
>

action=renameweb

Parameter Description Default
newsubweb Name of the web after move ''
newparentweb New parent web name ''
confirm If defined, requires a second level of confirmation. Supported values are "getlock", "continue", and "cancel" ''
 

action=editSettings

No parameters
Line: 173 to 181
 
Parameter Description Default
action register or verify or resetPassword or approve  
Added:
>
>
Note: The register script can only be called via http POST method, not GET. Make sure to specify the "post" method if you call the register script via a form action.
 

rename

Changed:
<
<
Used for renaming topics.
>
>
Used for renaming topics and attachments.
 
Parameter Description Default
skin skin(s) to use  
Line: 187 to 197
 
nonwikiword if defined, a non-wikiword is acceptable for the new topic name  
redirectto If the rename process is successful, rename will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Miscellaneous {AllowRedirectUrl}).
 
Added:
>
>
Note: The rename script can only be called via http POST method, not GET. Make sure you specify method="post" if you call the rename script via a form action.
 

rest

This REST (Representational State Transfer) script can be invoked via http in the same way as the other TWiki scripts (see Invocation Examples, below) to execute a function that is associated to a "subject" and a "verb" (see below). These functions are usually registered by plugins using the TWiki::Func::registerRESTHandler method. The rest script will print the result directly to the browser unless the endPoint parameter is specified, in which case it will output a redirect to the given topic.
Line: 198 to 210
  The function is free to use any other query parameters for its own purposes.
Changed:
<
<
ALERT! The rest script should always require authentication in any TWiki that has logins. Otherwise there is a risk of opening up major security holes. So make sure you add it to the list of authenticated scripts if you are using ApacheLogin.
>
>
ALERT! Note: The rest script should always require authentication in any TWiki that has logins. Otherwise there is a risk of opening up major security holes. So make sure you add it to the list of authenticated scripts if you are using ApacheLogin.
 

Invocation Examples

Line: 265 to 277
  Form field values are passed in parameters named 'field' - for example, if I have a field Status the parameter name is Status.
Added:
>
>
ALERT! Note: The save script can only be called via http POST method, not GET. Make sure to specify the "post" method if you call the save script via a form action. Example:
<form name="new" action="%SCRIPTURLPATH{save}%/Sandbox/" method="post">
    ...
</form>
It is not possible to call save from an <a href=""> link.
 

search

CGI gateway to the %SEARCH% functionality driven by the following CGI parameters:
Line: 323 to 343
  You can use a tool like curl to upload files from the command line using this script.
Added:
>
>
ALERT! Note: The upload script can only be called via http POST method, not GET.
 

view

Used for viewing topics.

Revision 72007-01-13 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 193 to 193
 The rest script supports the following parameters:
username If TemplateLogin, or a similar login manager not embedded in the web server, is used, then you need to pass a username and password to the server. The username and password parameters are used for this purpose.
password See username
Changed:
<
<
topic If defined as the full name (including web) of a topic, then when the script starts up plugins will be passed this as the "current" topic. If not defined, then %USERWEB%.WebHome will be passed to plugins.
>
>
topic If defined as the full name (including web) of a topic, then when the script starts up plugins will be passed this as the "current" topic. If not defined, then Main.WebHome will be passed to plugins.
 
endPoint Where to redirect the response once the request is served, in the form "Web.Topic"

The function is free to use any other query parameters for its own purposes.

Revision 62007-01-13 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 55 to 55
 configure is the browser script used for inspection and configuration of the TWiki configuration. None of the parameters to this script are useable for any purpose except configure. See configure.

edit

Changed:
<
<
The edit scipt understands the following parameters, typically supplied by HTML input fields:
>
>
The edit script understands the following parameters, typically supplied by HTML input fields:
 
Parameter Description Default
Changed:
<
<
action Optional. Use the editaction template instead of the standard edit. If action=text, then hide the form. If action=form hide the normal text area and only edit the form.  
>
>
action Optional. Use the editaction template instead of the standard edit. If action=text, then hide the form. If action=form hide the normal text area and only edit the form. You can change the Edit/Edit Raw buttons to always append the action parameter in skins like Pattern and Classic by setting the topic or preference variable EDITACTION to the value text or form. To edit the topic once the EDITACTION is defined as form simply remove the action=form from the browser URL of the edit script and reload the edit window  
 
onlynewtopic If set, error if topic already exists  
onlywikiname If set, error if topic name is not a WikiWord  
Changed:
<
<
templatetopic The name of the template topic, copied to get the initial content  
>
>
templatetopic The name of the template topic, copied to get the initial content (new topic only)  
 
text Initial text for the topic  
topicparent The parent topic  
Changed:
<
<
formtemplate Name of the form to instantiate in the topic. Overrides the form set in the templatetopic if defined.  
>
>
formtemplate Name of the form to instantiate in the topic. Overrides the form set in the templatetopic if defined. (will remove the form is set to 'none')  
 
contenttype Optional parameter that defines the application type to write into the CGI header. Defaults to text/html. May be used to invoke alternative client applications  
anyname Any parameter can passed to the new topic; if the template topic contains %URLPARAM{"anyname"}%, it will be replaced by its value  
breaklock If set, any lease conflicts will be ignored, and the edit will proceed even if someone is already editing the topic.  
Line: 232 to 232
 
onlynewtopic If set, error if topic already exists  
onlywikiname If set, error if topic name is not a WikiWord  
dontnotify if defined, suppress change notification  
Changed:
<
<
templatetopic Name of a topic to use as a template for the text and form  
>
>
templatetopic Name of a topic to use as a template for the text and form (new topic only)  
 
text New text of the topic  
forcenewrevision if set, forces a revision even if TWiki thinks one isn't needed  
topicparent If 'none' remove any current topic parent. If the name of a topic, set the topic parent to this.  
Changed:
<
<
formtemplate if defined, use the named template for the form  
>
>
formtemplate if defined, use the named template for the form (will remove the form is set to 'none')  
 
editaction When action is checkpoint, add form or replace form..., this is used as the action parameter to the edit script that is redirected to after the save is complete.  
originalrev Revision on which the edit started.  
edit The script to use to edit the topic when action is checkpoint edit
Line: 250 to 250
 
  1. The first sequence of ten or more X characters in the topic name will be converted to a number such that the resulting topic name is unique in the target web.
  2. When the action is save, checkpoint, quietsave, or preview:
    1. The new text is taken from the text parameter, if it is defined,
Changed:
<
<
      • otherwise it is taken from the templatetopic, if it is defined,
>
>
      • otherwise it is taken from the templatetopic, if it is defined, (new topic only)
 
      • otherwise it is taken from the previous version of the topic, if any,
    1. The name of the new form is taken from the formtemplate, if defined
Changed:
<
<
      • otherwise it is taken from the templatetopic, if defined,
>
>
      • otherwise it is taken from the templatetopic, if defined, (new topic only)
 
      • otherwise it is taken from the previous version of the topic, if any,
      • otherwise no form is attached.
    1. The value for each field in the form is taken from the query, if it is defined
Changed:
<
<
      • otherwise it is taken from the templatetopic, if defined,
>
>
      • otherwise it is taken from the templatetopic, if defined, (new topic only)
 
      • otherwise it is taken from the previous version of the topic, if any,
      • otherwise it defaults to the empty string.

Revision 52007-01-13 - TWikiContributor

Line: 1 to 1
Deleted:
<
<
 
Changed:
<
<

TWiki CGI and Command Line Scripts

>
>

TWiki CGI and Command Line Scripts

  Programs on the TWiki server performing actions such as rendering, saving and renaming topics.

The TWiki scripts are located in the twiki/bin and twiki/tools directories. This topic describes the interfaces to some of those scripts. All scripts in the twiki/bin directory can be called from the CGI (Common Gateway Interface) environment or from the command line. The scripts in the twiki/tools directory can only be called from the command line.

Added:
>
>
 

CGI Scripts

Details on CGI scripts located in the twiki/bin directory.
Line: 67 to 68
 
contenttype Optional parameter that defines the application type to write into the CGI header. Defaults to text/html. May be used to invoke alternative client applications  
anyname Any parameter can passed to the new topic; if the template topic contains %URLPARAM{"anyname"}%, it will be replaced by its value  
breaklock If set, any lease conflicts will be ignored, and the edit will proceed even if someone is already editing the topic.  
Changed:
<
<
redirectto If the user continues from edit to save, and if the save process is successful, save will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Miscellaneous {AllowRedirectUrl}).
 
>
>
redirectto If the user continues from edit to save, and if the save (or cancels the edit) process is successful, save will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Miscellaneous {AllowRedirectUrl}).
 
  Form field values are passed in parameters named 'field' - for example, if I have a field Status the parameter name is Status.
  1. The first sequence of ten or more X characters in the topic name will be converted on save to a number such that the resulting topic name is unique in the target web.
Line: 98 to 99
 
sitemapuseto Value for SITEMAPUSETO ''
nosearchall Value for NOSEARCHALL ''
Deleted:
<
<

action=deleteUserAccount

Unregisters (removes) the currently logged-in user.
Parameter Description Default
password Users' password none
 

action=editSettings

No parameters
Added:
>
>

action=saveSettings

Parameter Description Default
text Text of the topic ''
originalrev Revision that the edit started on Most recent revision
redirectto If the savesettings process is successful, save will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Miscellaneous {AllowRedirectUrl}).
All other parameters may be interpreted as form fields, depending on the current form definition in the topic.
 

action=bulkRegister

See BulkRegistration.
Parameter Description Default
Line: 113 to 116
 
EmailUsersWithDetails Whether to mail registered users or not false
LogTopic Topic to save the log in Same as topic name, with 'Result' appended.
Changed:
<
<

action=saveSettings

>
>

action=changePassword

Change password, email address, or both, of a user.
 
Parameter Description Default
Changed:
<
<
text Text of the topic ''
originalrev Revision that the edit started on Most recent revision
All other parameters may be interpreted as form fields, depending on the current form definition in the topic.
>
>
username god alone knows none
oldpassword current password none
password new password none
passwordA new password confirmation none
email new email address none
password, =passwordA and email are optional. If neither or password and passwordA is set, then the user password is left unchanged. If email is unset, their email is left unchanged.

action=resetPassword

Reset the password for a single or multiple users
Parameter Description Default
LoginName list of usernames to reset none - error if not set
Introduction message to be sent alongside the reset, most often used to announce to the user that they have been given an account. ''

This is used by BulkResetPassword and ResetPassword. Only administrators can provide a list of LoginNames, non-admins can only provide a single LoginName.

BulkRegistration provides the means to create multiple accounts but it does not announce those accounts to the users who own them. BulkResetPassword is used to assign the passwords, the Introduction is used to explain why they are receiving the mail.

action=deleteUserAccount

Unregisters (removes) the currently logged-in user.
Parameter Description Default
password Users' password none
 

oops

This script is mainly used for rendering pages containing error messages, though it is also used for some functional actions such as manage pages (move topic etc).
Line: 131 to 153
 
def Optional, can be set to the name of a single definition within template. This definition will be instantiated in the template wherever %INSTANTIATE% is seen. This lets you use a single template file for many messages. For an example, see oopsmanagebad.tmpl.  
paramN Where N is an integer from 1 upwards. These values will be substituted into template for %PARAM1% etc.  
Deleted:
<
<

passwd

Parameter Description Default
action one of changePassword or resetPassword none
Other parameters as described under manage, action=changePassword.

action=changePassword

Parameter Description Default
username Username  
oldpassword Existing password (plain text)  
password New password (plain text)  
passwordA New password confirmation (plain text)  
TopicName ?  
 

preview

This script is deprecated. Its functions are covered by the save script.
Line: 177 to 185
 
confirm if defined, requires a second level of confirmation  
currentwebonly if defined, searches current web only for links to this topic  
nonwikiword if defined, a non-wikiword is acceptable for the new topic name  
Changed:
<
<

resetpasswd

Reset the password for a single or multiple users
Parameter Description Default
LoginName list of usernames to reset none - error if not set
Introduction message to be sent alongside the reset, most often used to announce to the user that they have been given an account. ''

This is used by BulkResetPassword and ResetPassword. Only users belonging to the TWikiAdminGroup can provide a list of LoginNames, non-admins can only provide a single LoginName.

BulkRegistration provides the means to create multiple accounts but it does not announce those accounts to the users who own them. BulkResetPassword is used to assign the passwords, the Introduction is used to explain why they are receiving the mail.

>
>
redirectto If the rename process is successful, rename will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Miscellaneous {AllowRedirectUrl}).
 
 

rest

This REST (Representational State Transfer) script can be invoked via http in the same way as the other TWiki scripts (see Invocation Examples, below) to execute a function that is associated to a "subject" and a "verb" (see below). These functions are usually registered by plugins using the TWiki::Func::registerRESTHandler method. The rest script will print the result directly to the browser unless the endPoint parameter is specified, in which case it will output a redirect to the given topic.
Line: 228 to 227
 
action_preview preview edited text  
action_addform Redirect to the "change form" page.  
action_replaceform... Redirect to the "change form" page.  
Changed:
<
<
action_delRev Administrators only delete the most recent revision of the topic - all other parameters are ignored. You have to be a member of TWikiAdminGroup to use this, and not all store implementations will support it.  
action_repRev Administrators only replace the text of the most recent revision of the topic with the text in the text parameter. text must included embedded meta-data tags. All other parameters are ignored. You have to be a member of TWikiAdminGroup to use this, and not all store implementations will support it.  
>
>
action_delRev Administrators only delete the most recent revision of the topic - all other parameters are ignored. You have to be an administrator to use this, and not all store implementations will support it.  
action_repRev Administrators only replace the text of the most recent revision of the topic with the text in the text parameter. text must included embedded meta-data tags. All other parameters are ignored. You have to be an administrator to use this, and not all store implementations will support it.  
 
onlynewtopic If set, error if topic already exists  
onlywikiname If set, error if topic name is not a WikiWord  
dontnotify if defined, suppress change notification  
Line: 272 to 271
 
Parameter: Description: Default:
"text" Search term. Is a keyword search, literal search or regular expression search, depending on the type parameter. SearchHelp has more required
search="text" (Alternative to above) N/A
Changed:
<
<
web="Name"
web="Main, Know"
web="all"
Comma-separated list of webs to search. See TWikiVariables#VarSEARCH for more details. Current web
>
>
web="Name"
web="Main, Know"
web="all"
Comma-separated list of webs to search. See TWikiVariables#VarSEARCH for more details. Current web
 
topic="WebPreferences"
topic="*Bug"
Limit search to topics: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. All topics in a web
excludetopic="Web*"
excludetopic="WebHome, WebChanges"
Exclude topics from search: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. None
type="keyword"
type="literal"
type="regex"
Do a keyword search like soap "web service" -shampoo; a literal search like web service; or RegularExpression search like soap;web service;!shampoo %SEARCHVAR- DEFAULTTYPE% preferences setting (literal)
scope="topic"
scope="text"
scope="all"
Search topic name (title); the text (body) of topic; or all (both) "text"
order="topic"
order="created"
order="modified"
order="editby"
order=
 "formfield(name)"
Sort the results of search by the topic names, topic creation time, last modified time, last editor, or named field of TWikiForms. The sorting is done web by web; in case you want to sort across webs, create a formatted table and sort it with TablePlugin's initsort Sort by topic name
limit="all"
limit="16"
Limit the number of results returned. This is done after sorting if order is specified All results
Changed:
<
<
date="..." limits the results to those pages with latest edit time in the given TimeInterval. All results
>
>
date="..." limits the results to those pages with latest edit time in the given time interval. All results
 
reverse="on" Reverse the direction of the search Ascending search
casesensitive="on" Case sensitive search Ignore case
bookview="on" BookView search, e.g. show complete topic text Show topic summary
Line: 312 to 311
  see TWikiSiteTools#WebStatistics_site_statistics for updating statistics using cron.
Deleted:
<
<

twiki

Single-script interface to the functionality of all the other scripts. Experimental, not for production use. Read the code if you want to know more.
 

upload

Uploads an attachment to a topic. The HTTP request is expected to be in multipart/form-data format.
Parameter Description Default
Line: 335 to 331
 
raw=debug As raw=on, but also shows the metadata (forms etc) associated with the topic.  
raw=text Shows only the source of the topic, as plain text (Content-type: text/plain). Only shows the body text, not the form or other meta-data.
raw=all Shows only the source of the topic, as plain text (Content-type: text/plain), with embedded meta-data. This may be useful if you want to extract the source of a topic to a local file on disc.  
Changed:
<
<
section Allows to view only a part of the topic delimited by a named section (see VarSTARTSECTION). If the given section is not present, no topic content is displayed.  
>
>
section Allows to view only a part of the topic delimited by a named section (see VarSTARTSECTION). If the given section is not present, no topic content is displayed.  
 
contenttype Allows you to specify a different Content-Type: (e.g. contenttype=text/plain)  
rev Revision to view (e.g. rev=45)  
template Allows you to specify a different skin template, overriding the 'view' template the view script would normally use. The default template is view. For example, you could specify /do/view/TWiki/TWikiScripts?template=edit. This is mainly useful when you have specialised templates for a TWiki Application.  
Added:
>
>
topic redirects (at the beging of the cgi script running) to show the spcified Web.Topic, or, redirects to a URL, if allowed by {AllowRedirectUrl} and {PermittedRedirectHostUrls}  
  ALERT! For historical reasons, the view script has a special interpretation of the text skin. In earlier TWiki versions the skin=text parameter was used like this: http://.../view/MyWeb/MyTopic?skin=text&contenttype=text/plain&raw=on
Line: 352 to 349
 
filename name of attachment  
rev Revision to view  
Added:
>
>
Instead of using the filename parameter, you can append the attachment name to the end of the URL path (after the topic) e.g. https://afnog.iotworkshop.africa/do/viewfile/Webname/TopicName/Attachment.gif
 

Command Line Scripts

Details on command line scripts located in the twiki/tools directory.

Revision 42007-01-13 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 14 to 14
 

CGI environment

In the CGI environment parameters are passed to the scripts via the URL and URL parameters. Environment variables are also used to determine the user performing the action. If the environment is not set up, the default TWiki user is used (usually guest).

Command-line

Changed:
<
<
You must be cd'd to the twiki/bin directory to run the scripts from the command line. To avoid issues with file permissions, run the scripts as the web server user such as nobody or www.
>
>
You must be have the twiki/bin directory on the perl path to run the scripts from the command line. To avoid issues with file permissions, run the scripts as the web server user such as nobody or www.
  Parameters are passed on the command line using '-name' - for example,
$ cd /usr/local/twiki/bin
$ save -topic MyWeb.MyTopic -user admin -action save -text "New text of the topic"
Changed:
<
<
All parameters require a value.
>
>
All parameters require a value, even if that is the empty string.
 

Common parameters

All the scripts accept a number of common parameters. The first two components of the URL after the script name are taken as the web and the topic, respectively. Standard URL parameters are:
Line: 51 to 51
 NOTE: The result from changes script and the topic WebChanges can be different, if the changes file is deleted from a web. In particular, in new installations the changes script will return no results while the WebChanges topic will.

configure

Changed:
<
<
configure is the browser script used for inspection and configuration of the TWiki configuration. None of the parameters to this script are useable for any purpose except configure.
>
>
configure is the browser script used for inspection and configuration of the TWiki configuration. None of the parameters to this script are useable for any purpose except configure. See configure.
 

edit

The edit scipt understands the following parameters, typically supplied by HTML input fields:
Line: 67 to 67
 
contenttype Optional parameter that defines the application type to write into the CGI header. Defaults to text/html. May be used to invoke alternative client applications  
anyname Any parameter can passed to the new topic; if the template topic contains %URLPARAM{"anyname"}%, it will be replaced by its value  
breaklock If set, any lease conflicts will be ignored, and the edit will proceed even if someone is already editing the topic.  
Added:
>
>
redirectto If the user continues from edit to save, and if the save process is successful, save will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Miscellaneous {AllowRedirectUrl}).
 
  Form field values are passed in parameters named 'field' - for example, if I have a field Status the parameter name is Status.
  1. The first sequence of ten or more X characters in the topic name will be converted on save to a number such that the resulting topic name is unique in the target web.
Line: 188 to 189
 BulkRegistration provides the means to create multiple accounts but it does not announce those accounts to the users who own them. BulkResetPassword is used to assign the passwords, the Introduction is used to explain why they are receiving the mail.

rest

Changed:
<
<
This REST (Representational State Transfer) script can be invoked via http in a similar way as the view script (see Invocation Examples, below) to execute a function that is associated to a "subject" and a "verb" (see below). It'll print the result directly to the stream unless the endPoint parameter is specified, in which case the control is redirected to the given topic.

The rest script itself uses one parameter:

>
>
This REST (Representational State Transfer) script can be invoked via http in the same way as the other TWiki scripts (see Invocation Examples, below) to execute a function that is associated to a "subject" and a "verb" (see below). These functions are usually registered by plugins using the TWiki::Func::registerRESTHandler method. The rest script will print the result directly to the browser unless the endPoint parameter is specified, in which case it will output a redirect to the given topic.
 
Added:
>
>
The rest script supports the following parameters:
username If TemplateLogin, or a similar login manager not embedded in the web server, is used, then you need to pass a username and password to the server. The username and password parameters are used for this purpose.
password See username
topic If defined as the full name (including web) of a topic, then when the script starts up plugins will be passed this as the "current" topic. If not defined, then %USERWEB%.WebHome will be passed to plugins.
 
endPoint Where to redirect the response once the request is served, in the form "Web.Topic"
Changed:
<
<
Any additional parameters are passed directly to the function (i.e: The function can get any other parameter using the CGI $query object)
>
>
The function is free to use any other query parameters for its own purposes.

ALERT! The rest script should always require authentication in any TWiki that has logins. Otherwise there is a risk of opening up major security holes. So make sure you add it to the list of authenticated scripts if you are using ApacheLogin.

 

Invocation Examples

Line: 202 to 207
  http://my.host/bin/rest/<subject>/<verb>
Changed:
<
<
where <subject> must be the WikiWord name of one of the installed TWikiPlugins, and the <verb> is the alias for the function registered using the registerRESTHandler. The <subject> and <verb> are then used to lookup and call the registered function.

Functions outside the Plugins also can be registered, but please consider the security implications of allowing URL access, as functions can sidestep TWiki Authentication & Authorisation settings.

>
>
where <subject> must be the WikiWord name of one of the installed TWikiPlugins, and the <verb> is the alias for the function registered using the TWiki::Func::registerRESTHandler method. The <subject> and <verb> are then used to lookup and call the registered function.
  <subject> and <verb> are checked for illegal characters exactly in the same way as the web and topic names.
Line: 212 to 215
  Call the Plugin
Changed:
<
<
You can also call the function from the command line, but this will be run as the TWikiAdminGroup (as it is assumed that shell access is secure) - eg:
./rest EmptyPlugin.example

Note that for calls to Plugins, they must be enabled in configure.

>
>
Note that for Plugins to register REST handlers, they must be enabled in configure.
 

save

The save script performs a range of save-related functions, as selected by the action parameter.

Parameter Description Default
Changed:
<
<
action_save=1 default; save, return to view, dontnotify is OFF  
action_quietsave=1 save, and return to view, dontnotify is ON  
action_checkpoint save and redirect to the edit script, dontnotify is ON  
>
>
action_save=1 default; save, return to view, dontnotify is off  
action_quietsave=1 save, and return to view, dontnotify is on  
action_checkpoint save and redirect to the edit script, dontnotify is on  
 
action_cancel exit without save, return to view  
action_preview preview edited text  
action_addform Redirect to the "change form" page.  
Line: 239 to 240
 
formtemplate if defined, use the named template for the form  
editaction When action is checkpoint, add form or replace form..., this is used as the action parameter to the edit script that is redirected to after the save is complete.  
originalrev Revision on which the edit started.  
Added:
>
>
edit The script to use to edit the topic when action is checkpoint edit
editparams The parameter string to use to edit the topic  
redirectto The save process will redirect to this topic or URL if it is successful. (Typically this would be the URL that was being viewed when edit was invoked). The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Miscellaneous {AllowRedirectUrl}).
view topic being edited
  Any errors will cause a redirect to an oops page.
Line: 298 to 302
 
webs comma-separated list of webs to run stats on all accessible webs
logdate YYYYMM to generate statistics for current month
Added:
>
>
for example:
  1. from browser https://afnog.iotworkshop.africa/do/statistics updates all user webs
  2. from browser https://afnog.iotworkshop.africa/do/statistics?webs=TWiki,Main,Sandbox updates TWiki,Main,Sandbox
  3. from browser https://afnog.iotworkshop.africa/do/statistics/TWiki updates TWiki
  4. from command line twiki/bin/statistics updates all user webs
  5. from command line twiki/bin/statistics -webs=TWiki,Main,Sandbox updates TWiki,Main,Sandbox
  6. from command line twiki/bin/statistics TWiki.WebHome updates TWiki

see TWikiSiteTools#WebStatistics_site_statistics for updating statistics using cron.

 

twiki

Single-script interface to the functionality of all the other scripts. Experimental, not for production use. Read the code if you want to know more.
Line: 321 to 335
 
raw=debug As raw=on, but also shows the metadata (forms etc) associated with the topic.  
raw=text Shows only the source of the topic, as plain text (Content-type: text/plain). Only shows the body text, not the form or other meta-data.
raw=all Shows only the source of the topic, as plain text (Content-type: text/plain), with embedded meta-data. This may be useful if you want to extract the source of a topic to a local file on disc.  
Added:
>
>
section Allows to view only a part of the topic delimited by a named section (see VarSTARTSECTION). If the given section is not present, no topic content is displayed.  
 
contenttype Allows you to specify a different Content-Type: (e.g. contenttype=text/plain)  
rev Revision to view (e.g. rev=45)  
template Allows you to specify a different skin template, overriding the 'view' template the view script would normally use. The default template is view. For example, you could specify /do/view/TWiki/TWikiScripts?template=edit. This is mainly useful when you have specialised templates for a TWiki Application.  
Line: 342 to 357
 

geturl.pl

This is a very simple script to get the content of a web site. It is marked as deprecated and might be removed (or enhanced) in a future TWiki release. Its functions are covered by the standard wget and curl commands.
Changed:
<
<
  • Usage: geturl <host> <path> [<port> [<header>]]
  • Example: geturl some.domain /some/dir/file.html 80
>
>
  • Usage: geturl.pl <host> <path> [<port> [<header>]]
  • Example: geturl.pl some.domain /some/dir/file.html 80
 
  • Will get: http://some.domain:80/some/dir/file.html

rewriteshebang.pl

Revision 32005-03-27 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 16 to 16
 

Command-line

You must be cd'd to the twiki/bin directory to run the scripts from the command line. To avoid issues with file permissions, run the scripts as the web server user such as nobody or www.
Changed:
<
<
Parameters are passed using '-name' - for example,
>
>
Parameters are passed on the command line using '-name' - for example,
 
$ cd /usr/local/twiki/bin
$ save -topic MyWeb.MyTopic -user admin -action save -text "New text of the topic"
Line: 295 to 295
 

statistics

Refresh the WebStatistics topics in range of webs.
Parameter Description Default
Changed:
<
<
webs list of webs to run stats on none
>
>
webs comma-separated list of webs to run stats on all accessible webs
logdate YYYYMM to generate statistics for current month
 

twiki

Single-script interface to the functionality of all the other scripts. Experimental, not for production use. Read the code if you want to know more.

Revision 22005-03-27 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 154 to 154
 
rev1 the higher revision  
rev2 the lower revision  
render the rendering style {sequential, sidebyside, raw, debug} DIFFRENDERSTYLE, sequential
Changed:
<
<
type history, diff, last} history diff, version to version, last version to previous diff
>
>
type {history, diff, last} history diff, version to version, last version to previous diff
 
context number of lines of context  
TODO:
  • add a {word} render style
Line: 268 to 268
 
Parameter: Description: Default:
"text" Search term. Is a keyword search, literal search or regular expression search, depending on the type parameter. SearchHelp has more required
search="text" (Alternative to above) N/A
Changed:
<
<
web="Name"
web="Main, Know"
web="all"
Comma-separated list of webs to search. The special word all means all webs that doe not have the NOSEARCHALL variable set to on in their WebPreferences. You can specifically exclude webs from an all search using a minus sign - for example, web="all,-Secretweb". Current web
>
>
web="Name"
web="Main, Know"
web="all"
Comma-separated list of webs to search. See TWikiVariables#VarSEARCH for more details. Current web
 
topic="WebPreferences"
topic="*Bug"
Limit search to topics: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. All topics in a web
excludetopic="Web*"
excludetopic="WebHome, WebChanges"
Exclude topics from search: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. None
type="keyword"
type="literal"
type="regex"
Do a keyword search like soap "web service" -shampoo; a literal search like web service; or RegularExpression search like soap;web service;!shampoo %SEARCHVAR- DEFAULTTYPE% preferences setting (literal)

Revision 12005-03-27 - TWikiContributor

Line: 1 to 1
Added:
>
>

TWiki CGI and Command Line Scripts

Programs on the TWiki server performing actions such as rendering, saving and renaming topics.

The TWiki scripts are located in the twiki/bin and twiki/tools directories. This topic describes the interfaces to some of those scripts. All scripts in the twiki/bin directory can be called from the CGI (Common Gateway Interface) environment or from the command line. The scripts in the twiki/tools directory can only be called from the command line.

CGI Scripts

Details on CGI scripts located in the twiki/bin directory.

General Information

CGI environment

In the CGI environment parameters are passed to the scripts via the URL and URL parameters. Environment variables are also used to determine the user performing the action. If the environment is not set up, the default TWiki user is used (usually guest).

Command-line

You must be cd'd to the twiki/bin directory to run the scripts from the command line. To avoid issues with file permissions, run the scripts as the web server user such as nobody or www.

Parameters are passed using '-name' - for example,

$ cd /usr/local/twiki/bin
$ save -topic MyWeb.MyTopic -user admin -action save -text "New text of the topic"
All parameters require a value.

Common parameters

All the scripts accept a number of common parameters. The first two components of the URL after the script name are taken as the web and the topic, respectively. Standard URL parameters are:

Parameter Description Default
topic If this is set to a URL, TWiki will immediately redirect to that URL. Otherwise it overrides the URL and is taken as the topic name (you can pass Web.TopicName)  
user Command-line only; set the name of the user performing the action. Note: this usage is inherently insecure, as it bypasses webserver login constraints. For this reason only authorised users should be allowed to execute scripts from the command line.  
skin Overrides the default skin path (see TWikiSkins)  
cover Specifies temporary skin path to prepend to the skin path for this script only (see TWikiSkins)  

attach

Despite the name, this script doesn't actually attach a file to a topic - for that, use upload. This script is part of the transactions sequence executed when a file is uploaded from the browser. it just generates the "new attachment" page for a topic.

Parameter Description Default
filename Name of existing attachment (if provided, this is a "manage attachment" action) none (in which case this is a "new attachment" action)

changes

Shows all the changes in the given web.

The changes script can receive one parameter:

Parameter Description Default
minor If 0, show only major changes. If 1, show all the changes (both minor and major) 0

The main difference between invoking this script and using WebChanges is that WebChanges is based on a %SEARCH%, while this script reads the changes file in each web, making it much faster.

NOTE: The result from changes script and the topic WebChanges can be different, if the changes file is deleted from a web. In particular, in new installations the changes script will return no results while the WebChanges topic will.

configure

configure is the browser script used for inspection and configuration of the TWiki configuration. None of the parameters to this script are useable for any purpose except configure.

edit

The edit scipt understands the following parameters, typically supplied by HTML input fields:

Parameter Description Default
action Optional. Use the editaction template instead of the standard edit. If action=text, then hide the form. If action=form hide the normal text area and only edit the form.  
onlynewtopic If set, error if topic already exists  
onlywikiname If set, error if topic name is not a WikiWord  
templatetopic The name of the template topic, copied to get the initial content  
text Initial text for the topic  
topicparent The parent topic  
formtemplate Name of the form to instantiate in the topic. Overrides the form set in the templatetopic if defined.  
contenttype Optional parameter that defines the application type to write into the CGI header. Defaults to text/html. May be used to invoke alternative client applications  
anyname Any parameter can passed to the new topic; if the template topic contains %URLPARAM{"anyname"}%, it will be replaced by its value  
breaklock If set, any lease conflicts will be ignored, and the edit will proceed even if someone is already editing the topic.  

Form field values are passed in parameters named 'field' - for example, if I have a field Status the parameter name is Status.

  1. The first sequence of ten or more X characters in the topic name will be converted on save to a number such that the resulting topic name is unique in the target web.

NOTE: most skins support the definition of EDIT_SKIN, which is used as the value of the cover parameter in edit URLs. This allows you to override the default edit skin on a web, topic or user basis.

login

Used for logging in when TWiki login is being used (e.g TemplateLoginManager).
Parameter Description Default
origurl URL that was being accessed when an access violation occurred. the login process will redirect to this URL if it is successful none
username username of user logging in none
password password of user logging in none

logon

Used for logging in when Web Server authentication is being used (e.g. ApacheLoginManager). The script does nothing; it is purely a placeholder for triggering the login process. The webserver will be set up to require a valid user to access this script, thus triggering the webserver login process.

manage

Performs a range of management functions.
Parameter Description Default
action One of createweb, deleteUserAccount, editSettings or saveSettings none

action=createweb

Parameter Description Default
newweb Name of the new web ''
baseweb Name of the web to copy to create the new web ''
webbgcolor value for WEBBGCOLOR ''
sitemapwhat Value for SITEMAPWHAT ''
sitemapuseto Value for SITEMAPUSETO ''
nosearchall Value for NOSEARCHALL ''

action=deleteUserAccount

Unregisters (removes) the currently logged-in user.
Parameter Description Default
password Users' password none

action=editSettings

No parameters

action=bulkRegister

See BulkRegistration.
Parameter Description Default
OverwriteHomeTopics Whether to overwrite existing home topics or not false
EmailUsersWithDetails Whether to mail registered users or not false
LogTopic Topic to save the log in Same as topic name, with 'Result' appended.

action=saveSettings

Parameter Description Default
text Text of the topic ''
originalrev Revision that the edit started on Most recent revision
All other parameters may be interpreted as form fields, depending on the current form definition in the topic.

oops

This script is mainly used for rendering pages containing error messages, though it is also used for some functional actions such as manage pages (move topic etc).

oops templates are used with the oops script to generate system messages. This is done to make internationalisation or other local customisations simple.

The oops script supports the following parameters:

Parameter Description Default
template Name of the template file to display  
def Optional, can be set to the name of a single definition within template. This definition will be instantiated in the template wherever %INSTANTIATE% is seen. This lets you use a single template file for many messages. For an example, see oopsmanagebad.tmpl.  
paramN Where N is an integer from 1 upwards. These values will be substituted into template for %PARAM1% etc.  

passwd

Parameter Description Default
action one of changePassword or resetPassword none
Other parameters as described under manage, action=changePassword.

action=changePassword

Parameter Description Default
username Username  
oldpassword Existing password (plain text)  
password New password (plain text)  
passwordA New password confirmation (plain text)  
TopicName ?  

preview

This script is deprecated. Its functions are covered by the save script.

rdiff

Renders the differences between version of a TWiki topic

Parameter Description Default
rev1 the higher revision  
rev2 the lower revision  
render the rendering style {sequential, sidebyside, raw, debug} DIFFRENDERSTYLE, sequential
type history, diff, last} history diff, version to version, last version to previous diff
context number of lines of context  
TODO:
  • add a {word} render style

register

Parameter Description Default
action register or verify or resetPassword or approve  

rename

Used for renaming topics.

Parameter Description Default
skin skin(s) to use  
newweb new web name  
newtopic new topic name  
breaklock    
attachment    
confirm if defined, requires a second level of confirmation  
currentwebonly if defined, searches current web only for links to this topic  
nonwikiword if defined, a non-wikiword is acceptable for the new topic name  

resetpasswd

Reset the password for a single or multiple users
Parameter Description Default
LoginName list of usernames to reset none - error if not set
Introduction message to be sent alongside the reset, most often used to announce to the user that they have been given an account. ''

This is used by BulkResetPassword and ResetPassword. Only users belonging to the TWikiAdminGroup can provide a list of LoginNames, non-admins can only provide a single LoginName.

BulkRegistration provides the means to create multiple accounts but it does not announce those accounts to the users who own them. BulkResetPassword is used to assign the passwords, the Introduction is used to explain why they are receiving the mail.

rest

This REST (Representational State Transfer) script can be invoked via http in a similar way as the view script (see Invocation Examples, below) to execute a function that is associated to a "subject" and a "verb" (see below). It'll print the result directly to the stream unless the endPoint parameter is specified, in which case the control is redirected to the given topic.

The rest script itself uses one parameter:

endPoint Where to redirect the response once the request is served, in the form "Web.Topic"

Any additional parameters are passed directly to the function (i.e: The function can get any other parameter using the CGI $query object)

Invocation Examples

The rest script assumes that it will be called with URL in the form:

http://my.host/bin/rest/<subject>/<verb>

where <subject> must be the WikiWord name of one of the installed TWikiPlugins, and the <verb> is the alias for the function registered using the registerRESTHandler. The <subject> and <verb> are then used to lookup and call the registered function.

Functions outside the Plugins also can be registered, but please consider the security implications of allowing URL access, as functions can sidestep TWiki Authentication & Authorisation settings.

<subject> and <verb> are checked for illegal characters exactly in the same way as the web and topic names.

As an example, the EmptyPlugin has registered a function to be used with the rest script under the subject EmptyPlugin and the verb example. Click below to see the rest script in action (run as TWikiGuest).

Call the Plugin

You can also call the function from the command line, but this will be run as the TWikiAdminGroup (as it is assumed that shell access is secure) - eg:

./rest EmptyPlugin.example

Note that for calls to Plugins, they must be enabled in configure.

save

The save script performs a range of save-related functions, as selected by the action parameter.

Parameter Description Default
action_save=1 default; save, return to view, dontnotify is OFF  
action_quietsave=1 save, and return to view, dontnotify is ON  
action_checkpoint save and redirect to the edit script, dontnotify is ON  
action_cancel exit without save, return to view  
action_preview preview edited text  
action_addform Redirect to the "change form" page.  
action_replaceform... Redirect to the "change form" page.  
action_delRev Administrators only delete the most recent revision of the topic - all other parameters are ignored. You have to be a member of TWikiAdminGroup to use this, and not all store implementations will support it.  
action_repRev Administrators only replace the text of the most recent revision of the topic with the text in the text parameter. text must included embedded meta-data tags. All other parameters are ignored. You have to be a member of TWikiAdminGroup to use this, and not all store implementations will support it.  
onlynewtopic If set, error if topic already exists  
onlywikiname If set, error if topic name is not a WikiWord  
dontnotify if defined, suppress change notification  
templatetopic Name of a topic to use as a template for the text and form  
text New text of the topic  
forcenewrevision if set, forces a revision even if TWiki thinks one isn't needed  
topicparent If 'none' remove any current topic parent. If the name of a topic, set the topic parent to this.  
formtemplate if defined, use the named template for the form  
editaction When action is checkpoint, add form or replace form..., this is used as the action parameter to the edit script that is redirected to after the save is complete.  
originalrev Revision on which the edit started.  

Any errors will cause a redirect to an oops page.

The parameters are interpreted in according to the following rules.

  1. The first sequence of ten or more X characters in the topic name will be converted to a number such that the resulting topic name is unique in the target web.
  2. When the action is save, checkpoint, quietsave, or preview:
    1. The new text is taken from the text parameter, if it is defined,
      • otherwise it is taken from the templatetopic, if it is defined,
      • otherwise it is taken from the previous version of the topic, if any,
    2. The name of the new form is taken from the formtemplate, if defined
      • otherwise it is taken from the templatetopic, if defined,
      • otherwise it is taken from the previous version of the topic, if any,
      • otherwise no form is attached.
    3. The value for each field in the form is taken from the query, if it is defined
      • otherwise it is taken from the templatetopic, if defined,
      • otherwise it is taken from the previous version of the topic, if any,
      • otherwise it defaults to the empty string.

Merging is only enabled if the topic text comes from text and originalrev is > 0 and is not the same as the revision number of the most recent revision. If merging is enabled both the topic and the meta-data are merged.

Form field values are passed in parameters named 'field' - for example, if I have a field Status the parameter name is Status.

search

CGI gateway to the %SEARCH% functionality driven by the following CGI parameters:

Parameter: Description: Default:
"text" Search term. Is a keyword search, literal search or regular expression search, depending on the type parameter. SearchHelp has more required
search="text" (Alternative to above) N/A
web="Name"
web="Main, Know"
web="all"
Comma-separated list of webs to search. The special word all means all webs that doe not have the NOSEARCHALL variable set to on in their WebPreferences. You can specifically exclude webs from an all search using a minus sign - for example, web="all,-Secretweb". Current web
topic="WebPreferences"
topic="*Bug"
Limit search to topics: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. All topics in a web
excludetopic="Web*"
excludetopic="WebHome, WebChanges"
Exclude topics from search: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. None
type="keyword"
type="literal"
type="regex"
Do a keyword search like soap "web service" -shampoo; a literal search like web service; or RegularExpression search like soap;web service;!shampoo %SEARCHVAR- DEFAULTTYPE% preferences setting (literal)
scope="topic"
scope="text"
scope="all"
Search topic name (title); the text (body) of topic; or all (both) "text"
order="topic"
order="created"
order="modified"
order="editby"
order=
 "formfield(name)"
Sort the results of search by the topic names, topic creation time, last modified time, last editor, or named field of TWikiForms. The sorting is done web by web; in case you want to sort across webs, create a formatted table and sort it with TablePlugin's initsort Sort by topic name
limit="all"
limit="16"
Limit the number of results returned. This is done after sorting if order is specified All results
date="..." limits the results to those pages with latest edit time in the given TimeInterval. All results
reverse="on" Reverse the direction of the search Ascending search
casesensitive="on" Case sensitive search Ignore case
bookview="on" BookView search, e.g. show complete topic text Show topic summary
nonoise="on" Shorthand for nosummary="on" nosearch="on" nototal="on" zeroresults="off" noheader="on" noempty="on" Off
nosummary="on" Show topic title only Show topic summary
nosearch="on" Suppress search string Show search string
noheader="on" Suppress search header
Topics: Changed: By:
Show search header
nototal="on" Do not show number of topics found Show number
zeroresults="off" Suppress all output if there are no hits zeroresults="on", displays: "Number of topics: 0"
noempty="on" Suppress results for webs that have no hits. Show webs with no hits
header="..."
format="..."
Custom format results: see FormattedSearch for usage, variables & examples Results in table
expandvariables="on" Expand variables before applying a FormattedSearch on a search hit. Useful to show the expanded text, e.g. to show the result of a SpreadSheetPlugin %CALC{}% instead of the formula Raw text
multiple="on" Multiple hits per topic. Each hit can be formatted. The last token is used in case of a regular expression ";" and search Only one hit per topic
nofinalnewline="on" If on, the search variable does not end in a line by itself. Any text continuing immediately after the search tag on the same line will be rendered as part of the table generated by the search, if appropriate. off
separator=", " Line separator between hits Newline "$n"

statistics

Refresh the WebStatistics topics in range of webs.
Parameter Description Default
webs list of webs to run stats on none

twiki

Single-script interface to the functionality of all the other scripts. Experimental, not for production use. Read the code if you want to know more.

upload

Uploads an attachment to a topic. The HTTP request is expected to be in multipart/form-data format.
Parameter Description Default
hidefile if defined, will not show file in attachment table  
filepath local (client) path name of the file being uploaded. This is used to look up the data for the file in the HTTP query.  
filename deprecated, do not use  
filecomment Comment to associate with file in attachment table  
createlink if defined, will create a link to file at end of topic  
changeproperties if defined, this is a property change operation only - no file will be uploaded. null

You can use a tool like curl to upload files from the command line using this script.

view

Used for viewing topics.

Parameter
<-- -->
Sorted descending
Description Default
template Allows you to specify a different skin template, overriding the 'view' template the view script would normally use. The default template is view. For example, you could specify /do/view/TWiki/TWikiScripts?template=edit. This is mainly useful when you have specialised templates for a TWiki Application.  
rev Revision to view (e.g. rev=45)  
raw=text Shows only the source of the topic, as plain text (Content-type: text/plain). Only shows the body text, not the form or other meta-data.
raw=on Shows the text of the topic in a scrollable textarea  
raw=debug As raw=on, but also shows the metadata (forms etc) associated with the topic.  
raw=all Shows only the source of the topic, as plain text (Content-type: text/plain), with embedded meta-data. This may be useful if you want to extract the source of a topic to a local file on disc.  
contenttype Allows you to specify a different Content-Type: (e.g. contenttype=text/plain)  

ALERT! For historical reasons, the view script has a special interpretation of the text skin. In earlier TWiki versions the skin=text parameter was used like this: http://.../view/MyWeb/MyTopic?skin=text&contenttype=text/plain&raw=on which shows the topic as plain text; useful for those who want to download plain text for the topic. Using skin=text this way is DEPRECATED, use raw=text instead.

viewfile

Used for viewing attachments. Normally, a site will publish the attachments (pub) directory using a URL. However if it contains sensitive information, you will want to protect attachments using TWikiAccessControls. In this case, you can use the viewfile script to give access to attachments while still checking access controls.

Parameter Description Default
filename name of attachment  
rev Revision to view  

Command Line Scripts

Details on command line scripts located in the twiki/tools directory.

geturl.pl

This is a very simple script to get the content of a web site. It is marked as deprecated and might be removed (or enhanced) in a future TWiki release. Its functions are covered by the standard wget and curl commands.
  • Usage: geturl <host> <path> [<port> [<header>]]
  • Example: geturl some.domain /some/dir/file.html 80
  • Will get: http://some.domain:80/some/dir/file.html

rewriteshebang.pl

Simple script to rewrite the #!/usr/bin/perl shebang lines specific to your local Perl installation. It will rewrite the first line of all your TWiki cgi scripts so they use a different shebang line. Use it if your perl is in a non-standard location, or you want to use a different interpreter (such as 'speedy').

tick_twiki.pl

This script executes a number of non-essential regular administration tasks that will help keep your TWiki healthy and happy, such as removing expired sessions and lease files.

It is intended to be run as a cron job or a scheduled task once a week. Example crontab entry:
0 0 * * 0 cd /usr/twiki/bin && perl ../tools/tick_twiki.pl

Note: The script has to be run by a user who can write files created by the webserver user.

Related Topics: AdminDocumentationCategory, DeveloperDocumentationCategory

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiScripts.