Line: 1 to 1 | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
TWiki CGI and Command Line Scripts | |||||||||||||
Line: 8 to 8 | |||||||||||||
Added: | |||||||||||||
> > | |||||||||||||
CGI Scripts
Details on CGI scripts located in the | |||||||||||||
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 | |||||||||||||
Added: | |||||||||||||
> > | |||||||||||||
Command-line
You must have the | |||||||||||||
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 parametersAll 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:
| |||||||||||||
Changed: | |||||||||||||
< < |
| ||||||||||||
> > |
| ||||||||||||
| |||||||||||||
Added: | |||||||||||||
> > | |||||||||||||
| |||||||||||||
Line: 46 to 53 | |||||||||||||
| |||||||||||||
Added: | |||||||||||||
> > | |||||||||||||
| |||||||||||||
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: | |||||||||||||
> > | |||||||||||||
| |||||||||||||
Added: | |||||||||||||
> > | |||||||||||||
| |||||||||||||
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: | |||||||||||||
> > | |||||||||||||
| |||||||||||||
Line: 95 to 106 | |||||||||||||
| |||||||||||||
Added: | |||||||||||||
> > | |||||||||||||
| |||||||||||||
Added: | |||||||||||||
> > | |||||||||||||
| |||||||||||||
Line: 107 to 120 | |||||||||||||
Note: The manage script can only be called via http POST method for createweb renameweb , and deleteUserAccount . | |||||||||||||
Added: | |||||||||||||
> > | |||||||||||||
|
Parameter | Description | Default |
---|
sitemapwhat |
Value for SITEMAPWHAT | '' |
nosearchall |
Value for NOSEARCHALL | '' |
action=renameweb
Parameter | Description | Default |
---|
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
action=saveSettings
Parameter | Description | Default |
---|
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} ). |
action=bulkRegister
See BulkRegistration.
EmailUsersWithDetails |
Whether to mail registered users or not | false |
LogTopic |
Topic to save the log in | Same as topic name, with 'Result' appended. |
action=changePassword
Change password, email address, or both, of a user.
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
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).
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. |
preview
This script is deprecated. Its functions are covered by the save
script.
rdiff
Renders the differences between version of a TWiki topic
register
Parameter | Description | Default |
---|
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
Used for renaming topics and attachments.
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.copy
Used for copying the current topic in its entirety including its history and attachments.
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 and MetadataRepository.
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.
configure
.save
The save
script performs a range of save-related functions, as selected by the action
parameter.
save
from an <a href="">
link. 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. See TWikiVariables 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) |
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.
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 |
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 |
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 |
curl
to upload files from the command line using this script.
Note: The
upload
script can only be called via http POST method, not GET.
view
Used for viewing topics.
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 |
debug |
Put debug info to the debug log |
filename
parameter, you can append the attachment name
to the end of the URL path (after the topic) e.g. https://eso.org/projects/alma/arc/tw/bin/viewfile/Webname/TopicName/Attachment.gif
debug=1
URL parameter is supplied.
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.
geturl.pl some.domain /some/dir/file.html 80
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
It is intended to be run as a cron job or a scheduled task once a week. Example crontab entry: