Documentation of the TWiki Implementation (version TWiki-6.1.0, Mon, 16 Jul 2018, build 30610)
- (1) Login Username vs. Wiki Username
- (2) Wiki Variables
- (3) Notification of Changes by Email
- (4) TWiki Category Table
- (5) Implementation Notes
- (6) Installation Notes
Related Topics:
TWikiHistory,
TWikiPlannedFeatures,
TWikiEnhancementRequests.
(1) Login Username vs. Wiki Username
TWiki manages internally two usernames: Login username and Wiki username.
- Login username: When you login to the Intranet you use your login username, e.g.
thoeny
. TWiki uses this name internally to log who changed topics.
- Wiki username: Is your name in WikiNotation, e.g.
PeterThoeny
. When you create your own home page topic, you should use your WikiName for the topic name. Like that, your name will be linked automatically where ever it is used. Please create your home page in TWiki.Main, not any other TWiki web.
Note: When you write a WikiName of a user (your own or somebody else's) be sure to specify the Main web in front of the Wiki user name, e.g. write it as Main.wikiUsername. This assures that the name will be linked automatically to the TWiki.Main web, even if the text is written in a different Wiki web.
TWiki can map the Intranet username to the Wiki username automatically, provided that the Login username and Wiki username pair has been entered in the
TWikiUsers topic.
(2) Wiki Variables
TWiki Variables
Special text strings expand on the fly to display dynamic content, such as user data or system info
TWikiVariables are text strings - %VARIABLE%
or %VARIABLE{ parameter="value" }%
- that expand into content whenever a topic is rendered for viewing. There are two types of variables:
- Preferences variables: Can be defined and changed by the user.
Example: %T%
renders as
- Predefined variables: Defined by the TWiki system or by extensions.
Example: %CALCULATE{}%
is handled by the SpreadSheetPlugin
See list of all TWiki Variables currently defined in this TWiki installation.
TWiki Variables Wizard — to Find and Compose Variables
Pre-load image:
Using Variables
To use a variable type its name. For example,
- type
%T%
to get
(a preferences variable)
- type
%TOPIC%
to get TWikiVariables
(a predefined variable)
- type
%CALCULATE{ "$UPPER(Text)" }%
to get TEXT
(a variable defined by a plugin)
Note:
- To leave a variable unexpanded, precede it with an exclamation point, e.g. type
!%TOPIC%
to get %TOPIC%
- Variables are expanded relative to the topic they are used in, not the topic they are defined in
- Type
%ALLVARIABLES%
to get a full listing of all variables defined for a particular topic
Variable Names
Variable names must start with a letter, optionally followed by letters, numbers and underscore '_' characters. Both upper-case and lower-case characters can be used,
%MYVAR%
,
%MyVar%
,
%My2ndVar%
, and
%My_Var%
are valid names. Variables are case sensitive, e.g.
%MyVAR%
and
%MYVAR%
are not the same.
By convention all settings, predefined variables and variables handled by extensions are always UPPER-CASE.
Preferences Variables
Unlike predefined variables, preferences variables can be defined by the user in various places.
Setting Preferences Variables
You can set variables in all the following places:
- system level in TWiki.TWikiPreferences
- plugin topics (see TWikiPlugins)
- local site level in Main.TWikiPreferences
- user level in individual user topics in Main web
- If UserSubwebs is in effect, the topic specified by
%USERPREFSTOPIC%
in the user's subweb is read instead
- If
$TWiki::cfg{DemoteUserPreferences}
is true, this step is deferred to a later step. On this TWiki installation, $TWiki::cfg{DemoteUserPreferences}
is false
- web level in WebPreferences of each web
- If
EXTRAPREFERENCES
is defined at this point, it's regarded as having comma separated list of topics. Those topics are read in the listed order as if they were WebPreferences
- topic level in topics in webs
- session variables (if sessions are enabled)
- user level preferences are set at this point if
$TWiki::cfg{DemoteUserPreferences}
is true as mentioned at the step 4
Settings at higher-numbered levels override settings of the same variable at lower numbered levels, unless the variable was included in the setting of FINALPREFERENCES at a lower-numbered level, in which case it is locked at the value it has at that level.
If you are setting a variable and using it in the same topic, note that TWiki reads all the variable settings from the saved version of the topic before it displays anything. This means you can use a variable anywhere in the topic, even if you set it somewhere inconspicuous near the end.
But beware: it also means that if you change the setting of a variable you are using in the same topic,
preview
will show the wrong thing, and you must
save
the topic to see it correctly.
The syntax for setting variables is the same anywhere in TWiki (on its own TWiki bullet line, including nested bullets):
[multiple of 3 spaces] * [space] Set [space] VARIABLENAME [space] = [space] value
Examples:
* Set VARIABLENAME1 = value
* Set VARIABLENAME2 = value
Spaces between the = sign and the value will be ignored. You can split a value over several lines by indenting following lines with spaces - as long as you don't try to use * as the first character on the following line.
Example:
* Set VARIABLENAME = value starts here
and continues here
Whatever you include in your variable will be expanded on display, exactly as if it had been entered directly.
Example: Create a custom logo variable
- To place a logo anywhere in a web by typing
%MYLOGO%
, define the Variable on the web's WebPreferences topic, and upload a logo file, ex: mylogo.gif
. You can upload by attaching the file to WebPreferences, or, to avoid clutter, to any other topic in the same web, e.g. LogoTopic
. Sample variable setting in WebPreferences:
* Set MYLOGO = %PUBURL%/%WEB%/LogoTopic/mylogo.gif
You can also set preferences variables on a topic by clicking the link
Edit topic preference settings
under
More topic actions
. Use the same
* Set VARIABLENAME = value
syntax. Preferences set in this manner are not visible in the topic text, but take effect nevertheless.
Controlling User Level Preferences Override
By default, user level variables are set at the step 4 as stated in the previous section.
That means a user can finalise some preferences variables so that web level or topic level setting cannot override it.
This may result in a situation the web or page owner doesn't expect.
$TWiki::cfg{DemoteUserPreferences}
has been introduced to avoid it.
If it's set to true, user level variables are set at the last step instead of the step 4.
But this is not enough.
To guarantee a certain result, you need to finalise critical preferences variables set at the web or topic level, which is cumbersome.
So preferences variables
DENYUSERPREFEENCES
and
ALLOWUSERPREFERENCES
have been introduced.
-
DENYUSERPREFEENCES
and ALLOWUSERPREFERENCES
may have comma separated list of variable names
- If a preferences variable is listed in
DENYUSERPREFEENCES
, the variable cannot be overridden at the user level. There is a special value "all", which means no preferences variables can be overridden at the user level
- If
ALLOWUSERPREFERENCES
is set and not empty, only the listed preferences variables can be overridden. There is a special value "all", which means any preferences variable can be overridden at the user level. But actually, "all" is not necessary since a blank value or not setting ALLOWUSERPREFERENCES
has the same effect
-
DENYUSERPREFEENCES
takes precedence over ALLOWUSERPREFERENCES
. If a variable is listed on both, it cannot be overridden. If DENYUSERPREFEENCES
is "all", the value of ALLOWUSERPREFERENCES
doesn't matter.
For example, if you don't allow overriding at the user level at all:
* Set DENYUSERPREFERENCES = all
If you allow
INYMCEPLUGIN_DISABLE
and
SKIN
to be set at the user level:
* Set ALLOWUSERPREFERENCES = TINYMCEPLUGIN_DISABLE, SKIN
If you allow user preferences to set anything other than
TINYMCEPLUGIN_DISABLE
or
SKIN
:
* Set DENYUSERPREFERENCES = TINYMCEPLUGIN_DISABLE, SKIN
Please note
DENYUSERPREFEENCES
and
ALLOWUSERPREFERENCES
affect user preferences regardless of
$TWiki::cfg{DemoteUserPreferences}
.
You can set those variables at the site level while
$TWiki::cfg{DemoteUserPreferences}
setting to false.
If you do so, you should finalise
DENYUSERPREFEENCES
and
ALLOWUSERPREFERENCES
.
Otherwise, they might be overridden by user preferences.
You will get the most benefit of
DENYUSERPREFEENCES
and
ALLOWUSERPREFERENCES
by setting
$TWiki::cfg{DemoteUserPreferences}
to true.
That way, each web can specify how much user level preferences overriding is allowed.
Parameterized Variables (Macros)
It is possible to pass parameters to TWiki variables. This is called a macro in a programming language.
To define a parameterized variable, set a variable that contains other variables, such as:
* Set EXAMPLE = Example variable using %DEFAULT%, %PARAM1% and %PARAM2%
* Set DEMO = Demo using %DEFAULT{ default="(undefined)" }%,
%PARAM1{ default="(undefined)" }% and %PARAM2{ default="(undefined)" }%
A special
%DEFAULT%
variable denotes the default (nameless) parameter of the calling variable. Variables optionally may list a
default="..."
parameter that gets used in case the calling variable does not specify that parameter.
To use a parameterized variable (or call a macro), add parameters within the curly brackets, such as:
* %EXAMPLE{ "foo" PARAM1="bar" PARAM2="baz" }%
* %DEMO{ "demo" PARAM2="parameter 2" }% -- note that PARAM1 is missing
which resolves to:
- %EXAMPLE{ "foo" PARAM1="bar" PARAM2="baz" }%
- %DEMO{ "demo" PARAM2="parameter 2" }% -- note that PARAM1 is missing
Parameters in the variable definition are expanded using the following sequence:
- Parameter from variable call. In above example,
%PARAM1%
gets expanded to bar
.
- Session variable and preferences settings
Example
Define variables:
* Set DRINK = red wine
* Set FAVORITE = My %DEFAULT{default="favorite"}% dish is %DISH{default="steak"}%,
my %DEFAULT{default="favorite"}% drink is %DRINK%.

The default can be defined with a default parameter (
%DISH{default="steak"}%
), or as a preferences setting (
Set DRINK = ...
).
Use Variables:
%FAVORITE{ DISH="Sushi" DRINK="Sake" }%
Returns:
%FAVORITE{ DISH="Sushi" DRINK="Sake" }%
%FAVORITE{}%
Returns:
%FAVORITE{}%
%FAVORITE{ "preferred" }%
Returns:
%FAVORITE{ "preferred" }%
Access Control Variables
These are special types of preferences variables to control access to content.
TWikiAccessControl explains these security settings in detail.
Local values for variables
Certain topics (a users home topic, web site and default preferences topics) have a problem; variables defined in those topics can have two meanings. For example, consider a user topic. A user may want to use a double-height edit box when they are editing their home topic - but
only when editing their home topic. The rest of the time, they want to have a normal edit box. This separation is achieved using
Local
in place of
Set
in the variable definition. For example, if the user sets the following in their home topic:
* Set EDITBOXHEIGHT = 10
* Local EDITBOXHEIGHT = 20
Then when they are editing any other topic, they will get a 10 high edit box. However when they are editing their home topic, they will get a 20 high edit box.
Local
can be used wherever a preference needs to take a different value depending on where the current operation is being performed.
Use this powerful feature with great care!
%ALLVARIABLES%
can be used to get a listing of the values of all variables in their evaluation order, so you can see variable scope if you get confused.
Frequently Used Preferences Variables
The following preferences variables are frequently used. They are defined in
TWikiPreferences#Miscellaneous_Settings:
-
%BB%
- line break and bullet combined
-
%BB2%
- level 2 bullet with line break
-
%BB3%
- level 3 bullet with line break
-
%BB4%
- level 4 bullet with line break
-
%BR%
- line break
-
%BULLET%
- bullet sign
-
%CARET%
- caret symbol
-
%VBAR%
- vertical bar
-
%H%
-
Help icon
-
%I%
-
Idea icon
-
%M%
-
Moved to icon
-
%N%
-
New icon
-
%P%
-
Refactor icon
-
%Q%
-
Question icon
-
%S%
-
Pick icon
-
%T%
-
Tip icon
-
%U%
-
Updated icon
-
%X%
-
Alert icon
-
%Y%
-
Done icon
-
%RED% text %ENDCOLOR%
- colored text (also %YELLOW%
, %ORANGE%
, %PINK%
, %PURPLE%
, %TEAL%
, %NAVY%
, %BLUE%
, %AQUA%
, %LIME%
, %GREEN%
, %OLIVE%
, %MAROON%
, %BROWN%
, %BLACK%
, %GRAY%
, %SILVER%
, %WHITE%
)
-
%REDBG% text %ENDBG%
- colored background (also %YELLOWBG%
, %ORANGEBG%
, %PINKBG%
, %PURPLEBG%
, %TEALBG%
, %NAVYBG%
, %BLUEBG%
, %AQUABG%
, %LIMEBG%
, %GREENBG%
, %OLIVEBG%
, %MAROONBG%
, %BROWNBG%
, %BLACKBG%
, %GRAYBG%
, %SILVERBG%
, %WHITEBG%
)
There are additional useful preferences variables defined in
TWikiPreferences, in
Main.TWikiPreferences, and in
WebPreferences of every web.
Predefined Variables
Most predefined variables return values that were either set in the configuration when TWiki was installed, or taken from server info (such as current username, or date and time). Some, like
%SEARCH%
, are powerful and general tools.
- Show all TWiki Variables
- Predefined variables can be overridden by preferences variables (except a few such as TOPIC and WEB)
- Extensions may extend the set of predefined variables (see individual extension topics for details)
- Take the time to thoroughly read through ALL preference variables. If you actively configure your site, review variables periodically. They cover a wide range of functions, and it can be easy to miss the one perfect variable for something you have in mind. For example, see
%INCLUDINGTOPIC%
, %INCLUDE%
, and the mighty %SEARCH%
.
Search or List Variables by Category
All TWiki Variables:
ACTIVATEDPLUGINS,
ADDTOHEAD,
ALLVARIABLES,
AQUA,
ATTACHURL,
ATTACHURLPATH,
AUTHREALM,
BASETOPIC,
BASEWEB,
BB,
BB2,
BB3,
BB4,
BLACK,
BLUE,
BR,
BROWN,
BUBBLESIG,
BULLET,
CALC,
CALCULATE,
CARET,
CHILDREN,
COLORPICKER,
COMMENT,
CONTENTMODE,
COPY,
DASHBOARD,
DATE,
DATEPICKER,
DISPLAYTIME,
DISPLAYTIME2,
EDITACTION,
EDITFORM,
EDITFORMFIELD,
EDITTABLE,
ENCODE,
ENDBG,
ENDCOLOR,
ENDCOLUMNS,
ENDSECTION,
ENTITY,
ENV,
EXAMPLEVAR,
FAILEDPLUGINS,
FORM,
FORMFIELD,
FOURCOLUMNS,
GET,
GMTIME,
GMTIME2,
GRAY,
GREEN,
GROUPS,
H,
HEADLINES,
HIDE,
HIDEINPRINT,
HOMETOPIC,
HTTP,
HTTPHOST,
HTTPS,
I,
ICON,
ICONURL,
ICONURLPATH,
IF,
INCLUDE,
INCLUDINGTOPIC,
INCLUDINGWEB,
JQENDTAB,
JQENDTABPANE,
JQTAB,
JQTABPANE,
LANGUAGE,
LANGUAGES,
LAQUO,
LIME,
LOCALSITEPREFS,
LOGIN,
LOGINURL,
LOGOUT,
LOGOUTURL,
M,
MAINWEB,
MAKETEXT,
MAROON,
MDREPO,
META,
METASEARCH,
N,
NAVY,
NBSP,
NOP,
NOTIFYTOPIC,
OLIVE,
ORANGE,
P,
PARENTBC,
PARENTTOPIC,
PINK,
PLUGINDESCRIPTIONS,
PLUGINVERSION,
PUBURL,
PUBURLPATH,
PURPLE,
Q,
QUERYPARAMS,
QUERYSTRING,
RAQUO,
RED,
REDBG,
REG,
REMOTEADDR,
REMOTEPORT,
REMOTEUSER,
RENDERLIST,
REVINFO,
REVINFO2,
S,
SCRIPTNAME,
SCRIPTSUFFIX,
SCRIPTURL,
SCRIPTURL2,
SCRIPTURLPATH,
SCRIPTURLPATH2,
SEARCH,
SERVERTIME,
SERVERTIME2,
SESSIONID,
SESSIONVAR,
SESSIONVARIABLE,
SET,
SETGETDUMP,
SILVER,
SITENAME,
SITESTATISTICSTOPIC,
SLIDESHOWEND,
SLIDESHOWSTART,
SPACEDTOPIC,
SPACEOUT,
STARTINCLUDE,
STARTSECTION,
STATISTICSTOPIC,
STOPINCLUDE,
SYSTEMWEB,
T,
TABLE,
TEAL,
THREECOLUMNS,
TM,
TOC,
TOC2,
TOPIC,
TOPICLIST,
TOPICTITLE,
TOPICURL,
TWIKISHEET,
TWIKIWEB,
TWISTY,
TWOCOLUMNS,
U,
URLPARAM,
USERINFO,
USERNAME,
USERREPORT,
USERSIG,
USERSWEB,
VAR,
VBAR,
WEB,
WEBLIST,
WEBPREFSTOPIC,
WHITE,
WIKIHOMEURL,
WIKILOGOALT,
WIKILOGOIMG,
WIKILOGOURL,
WIKINAME,
WIKIPREFSTOPIC,
WIKITOOLNAME,
WIKIUSERNAME,
WIKIUSERSTOPIC,
WIKIVERSION,
WIKIWEBMASTER,
WIKIWEBMASTERNAME,
WIP,
X,
Y,
YELLOW, total 190 variables
Documenting TWiki Variables
This section is for people documenting TWiki variables of the TWiki core and TWiki extensions.
Each variable is documented in a topic named
Var<name>
in the TWiki web. For example, a
%LIGHTSABER%
variable has a documentation topic called VarLIGHTSABER. The topic is expected to have a specific format so that reports in this TWikiVariables topic, in
TWikiVariablesSearch and in category topics work as expected.
Basic structure of a variable documentation topic:
- Parent set to TWikiVariables
- An anchor named the same like the topic, such as
#VarLIGHTSABER
- A
---+++
(level 3) heading with variable name, --
, short description
- A bullet with description of the variable (optional)
- A
Syntax:
bullet with example syntax
- A
Parameters:
bullet with a table explaining the parameters (optional)
- An
Example:
bullet or two with examples
- An
Expands to:
bullet with expanded variable (optional)
- A
Note:
bullet with notes (optional)
- A
Category:
bullet with one or more of the TWiki variables categories:
AdministrationVariables, ApplicationsAndComponentsVariables, AttachmentsAndFilesVariables, ChartingAndDrawingVariables, DatabaseAndFormsVariables, DateAndTimeVariables, DevelopmentVariables, EditingAndContentUpdateVariables, EmailAndNotificationVariables, ExportAndPublishingVariables, FormattingAndRenderingVariables, ImportVariables, LinkingAndNavigationVariables, SearchingAndListingVariables, SecurityAndAccessControlVariables, SkinsAndTemplatesVariables, SystemInformationVariables, TablesAndSpreadsheetsVariables, UIAndVisualizationVariables, UsersAndAuthenticationVariables, WorkflowAndAutomationVariables - A
Related:
bullet with related links. Links have conditional IF so that links work properly locally in variable documentation topics and in the TWikiVariables topic
Example content of a
VarLIGHTSABER
topic:
#VarLIGHTSABER
---+++ LIGHTSABER -- laser sword to fend of unethical competition
* The =%<nop>LIGHTSABER{}%= variable is handled by the LightsaberPlugin.
* Syntax: =%<nop>LIGHTSABER{ _parameters_ }%=
* Parameters:
| *Parameter* | *Description* | *Default* |
| =color="..."= | Color: =red=, =glue=, =green= | =white= |
| =sound="..."= | Sound: =none=, =standard=, =loud= | =none= |
* Example: =%<nop>LIGHTSABER{ color="red" }%= shows a red Lightsaber
* Expands to: =%LIGHTSABER{ color="red" }%=
* Note: The Lightsaber is a fictional weapon in the Star Wars universe, a "laser sword."
* Category: FormattingAndRenderingVariables, UIAndVisualizationVariables
* Related: [[%IF{"'%INCLUDINGTOPIC%'='TWikiVariables'" then="#"}%VarPLASMA][PLASMA]], LightsaberPlugin
(3) Notification of Changes by Email
Each TWiki web does an automatic email notification of recent changes. Users can subscribe / unsubscribe themselves in WebNotify of each TWiki web. The Perl script
mailnotify
is called by a deamon once every 60 minutes. For each Twiki web
mailnotify
is sending an automated email to subscribed users in case some topics changed within these 60 minutes.
Implementation note: Edit the cron table so that
mailnotify
is called every 60 minutes. Please consult
man crontab
of how to modify the table that schedules program execution at certain intervals. Example:
% crontab -e
15,45 * * * * (cd ~twiki/public_html/bin; ./mailnotify)
The above line will call mailnotify at 15 minutes and 45 minutes passed every hour.
(4) TWiki Category Table
It is possible to add a category table to a TWiki web. This permits storing and searching for more structured information. Editing a topic shows a HTML form with the usual text area and a table with selectors, checkboxes, radio buttons and text fields. The category table is shown at the end of a topic. The format of the category table can be defined per TWiki web.
If you want to use a Category Table in a TWiki web you need to have the following three files in the twiki/templates/{Yourweb} directory:
- twikicatitems.tmpl : Defines the items in the table
- twikicatedit.tmpl : Defines the look of the table when editing a topic
- twikicatview.tmpl : Defines the look of the table when viewing a topic
_Format of category definition template twikicatitems.tmpl_
Valid lines:
select|{name}|{selSize}|{val1}|{val2}|{val3}...
checkbox|{name}|{checkFlag}|{itemsPerLine}|{val1}|{val2}|{val3}...
radio|{name}|{itemsPerLine}|{val1}|{val2}|{val3}...
text|{name}|{charSize}
# comments start with a # character
Explanation:
{name} name of tag
{selSize} vertical size of SELECT tag
{val1}|{val2}... values
{checkFlag} set to true for [Set] [Clear] buttons, else set to false
{itemsPerLine} input items per line before wrap around, 0 if no wrap around
{charSize} number of characters for text fields
_Remark:_ Line radio|UseCategory|0|Yes|No
has a special meaning. If present, it is possible to choose in "edit" if the category table is included in the topic or not
Example file:
radio|UseCategory|0|Yes|No, delete this category table
select|TopicClassification|1|Select one...|NoDisclosure|PublicSupported|PublicFAQ
checkbox|OperatingSystem|true|5|OsSolaris|OsSunOS|OsHPUX|OsWin
text|OsVersion|16
_Format of twikicatedit.tmpl and twikicatview.tmpl_
Use the example below and customize if needed. twikicatedit.tmpl and twikicatview.tmpl can be identical, but they do not have to be.
_Attention:_ <!--TWikiCat-->
is needed at the beginning and end as markers. Do not delete them!
Example:
<!--TWikiCat--> <h4> TWikiCategory </h4>
<table border="2" cellspacing="1" cellpadding="1">
%REPEAT%<tr>
<td valign="top" align="right"> %CATNAME%: <br>%CATMODIFIER%</td><td> %CATVALUE% </td>
</tr>%REPEAT%
</table><!--TWikiCat-->
Above template files will result in the following category table when _viewing_ a topic:
Above template files will result in the following table when
_editing_ a topic:
Note: It is possible to force the values of a category table when creating a new topic. This is useful to create new topics using a form for the topic name. The default values of the category table can be specified as hidden fields if needed, i.e.
<input type="hidden" name="someCategory" value="someValue">
Example (edit this page to see the source) :
(5) Implementation Notes
_Platform_
TWiki is written in PERL 5, but it uses also many shell command. The current implementation runs only on a Unix machine. RCS for revision control must be installed on the system.
_Directories_
Directory: |
Used for: |
twiki/bin |
TWiki PERL scripts |
twiki/pub |
Public files (FileAttachments, images) |
twiki/data |
source text |
twiki/templates |
HTML templates, used by TWiki scripts |
_Files in twiki/bin_
File: |
Used for: |
.htaccess.txt |
Authentication. Rename to .htaccess and customize if used |
attach |
Script that shows the attach file page (FileAttachment) |
changes |
Script that shows recent changes |
delete |
(not used yet) |
edit |
Script to edit a topic |
geturl |
Script to fetch URL data |
mailnotify |
Script called by cron job to notify users of changes |
oops |
Script that shows a OK or oops dialog |
preview |
Script to preview topic after edit |
rdiff |
Script to see differences of topics |
register |
Script to register new users |
save |
Script that saves a topic, called by preview |
search |
Script that displays search results |
statistics |
Script to create statistics topic |
testenv |
Script to test CGI environment variables |
upload |
Script that does file upload (FileAttachment) |
view |
Script to view a topic ( the script ) |
viewfile |
Script to view an file attachment |
wiki.pm |
main TWiki library |
wikicfg.pm |
for initialization and configuration, used by wiki.pm |
wikisearch.pm |
search engine, used by wiki.pm |
(6) Installation Notes
These installation steps use Apache web server on Linux as an example. TWiki should run on other web servers and Unix systems as well.
Note: These installation notes assume user nobody
for all files manupulated by the cgi scripts (executed by the web server), and user twiki
for all other files. You need to replace user nobody
with an other user in case the web server executes the script with a different user ( default for Debian is www-data
). Also, you can substitute user twiki
with your own user name.
- Request the TWiki distribution (in Unix ZIP format) from http://TWiki.SourceForge.net/download.html
.
- Create directory
/home/httpd/twiki
and unzip the TWiki distribution to this directory.
- The
twiki/bin
directory of TWiki must be set as a cgi-bin directory. Add /home/httpd/twiki/bin
to /etc/httpd/conf/access.conf
with only ExecCGI
option.
- The
twiki/pub
directory of TWiki must be set so that it is visible as a URL. Add /home/httpd/twiki/pub
to /etc/httpd/conf/access.conf
with normal access options (copy from /home/httpd/html).
- Now add
Alias
for /twiki/pub
and ScriptAlias
for /twiki/bin
to /etc/httpd/conf/srm-conf
.
- Restart Apache by
/etc/rc.d/rc5.d/S85httpd restart
.
- Test if the
twiki/bin
directory is cgi-enabled:
- Enter the URL of that directory into your browser (
http://your.domain.com/twiki/bin
). It is not set correctly as cgi-bin in case you get something like "Index of /twiki/bin"
. It is OK if you get a message like "Forbidden. You don't have permission to access /twiki/bin/ on this server."
- Execute the
testenv
script from your browser ( http://your.domain.com/twiki/bin/testenv
). It should show a table of all CGI environment variables.
- Make sure PERL and the PERL CGI library is installed on your system. Default location of PERL executable is
/usr/bin/perl
. In case PERL is installed in a different location, the first line of all perl scripts in the twiki/bin
directory need to be changed (alternatively you can create a symbolic link from /usr/bin/perl
).
- To be able to edit the perl scripts and .tmpl files it is necessary to
chown
and chgrp -R twiki
so all the files have the owner you want.
- The scripts execute as
nobody
. Set the file permission of all Perl scripts in the twiki/bin
directory as executable to -rw-r-xr-x
.
- Set the file permission of all files below
twiki/data
to 666 ( -rw-rw-rw-
).
- Set the file permission of the
twiki/data
directory and all its subdirectories to 777 ( drwxrwxrwx
).
- Set the file permission of the
twiki/pub
directory to 777 ( drwxrwxrwx
).
- Edit the file
twiki/bin/wikicfg.pm
and set the variables at the beginning of the file to your needs.
- Make sure RCS is installed. In case RCS is not in the
path
environment variable, add it to path
. Alternatively, add the full path name to the rcs, ci, co, rlog, rcsdiff
commands in the variables of twiki/bin/wikicfg.pm
.
- Point your browser at http://your.domain.com/twiki/bin/view
and start wiki-ing away!
- Note in case cgi user is not
nobody
: The *,v
RCS repository files delivered with the installation package are locked by user nobody
. In case the user is different (e.g. www-data
), it is not possible to check in files, this has the effect that the topic version number does not increase when saving a topic. In this case you need to unlock all repository files and lock them as user www-data
(check the rcs man pages), or simply delete all the repository files.
- Security issue: Directories
twiki/data
, twiki/templates
and all its subdirectories should be set so that they are not visible as a URL. (Alternatively, move the directries to a place where they are not visible, and change the variables in twiki/bin/wikicfg.pm
accordingly)
- Enable email notification of topic changes, (3) has more.
- Optional: You can add new rendering rules or new %variables%. To insure an easy upgrade of TWiki it is recommended to do this customization in
twiki/bin/wikicfg.pm
, not twiki/bin/wiki.pm
.
- Optional: If you are on a public server and you would like to authenticate users you need to rename file
.htaccess.txt
in the twiki/bin
directory to .htaccess
and change it to your needs. For details consult the HTTP server documentation (for Apache server: [1], [2], [3]). Note: In case .htaccess
does not have any effect you need to enable it: Add "AllowOverride All" to the Directory section of access.conf
for your twiki/bin
directory.
- Optional: You can automatically generate usage statistics for all webs. To enable this:
- Make sure variable
$doLogTopicView, $doLogTopicSave and $doLogTopicUpload
in wikicfg.pm
are set. This will generate log entries in file twiki/data/log<date>.txt
.
- Topic WebStatistics must be present in all webs where you want to have statistics. You can use the topic in the Main web as a template.
- Call the
twiki/bin/statistics
script from a cron job, once a day is recommended. This will update the WebStatistics topics in all webs.
- Attention: The script must run as the same user as the CGI scripts are running, which is user
nobody
on most systems. Example crontab entry:
0 0 * * * (cd /path/to/TWiki/bin; ./statistics >/dev/null 2>&1)
- There is a workaround in case you can't run the script as user
nobody
: Run the utility twiki/bin/geturl
in your cron job and specify the URL of the twiki/bin/statistics
script as a parameter. Example:
0 0 * * * (cd /path/to/TWiki/bin; ./geturl mydomain.com /urlpath/to/TWiki/bin/statistics >/dev/null 2>&1)
- The
twiki/bin/statistics
script can also be executed as a CGI script, just enter the URL in your browser. Examples:
- Update current month for all webs:
http://mydomain.com/twiki/bin/statistics
- Update current month for Main web only:
http://mydomain.com/twiki/bin/statistics/Main
- Update January 2000 for Main web:
http://mydomain.com/twiki/bin/statistics/Main?logdate=200001
- To create a new web:
- Use a name for the web consisting of characters
A..Z
, a..z
but not in WikiNotation.
- Create a new template directory under
twiki/templates
.
- Create a new data directory under
twiki/data
and check the file permission of the directory.
- Copy the files
WebHome.txt
, WebPreferences.txt
, WebNotify.txt
, WebSearch.txt
and WebStatistics.txt
from the twiki/data/Main
directory to the new data directory, preserving the original files' owner, group and permissions ( on Unix use cp -p
). The data files must be writable by the owner the CGI scripts are running on ( usually nobody
). Hint: You can set permissions of .txt
and .txt,v
files to -rw-rw-rw-
and then edit the topic using your browser, RCS will restore the file permission correctly when saving the topic.
- Add the new web to the web list (on top of each topic) by editing the site-level preferences TWikiPreferences:
- Add the new web to the WIKIWEBLIST variable.
- Add the new web to the web table (at the bottom of each WebHome topic) by editing the TWikiWebsTable topic.
- Change the web preferences by editing the WebPreferences topic of the new web:
- Set the WEBBGCOLOR variable to a color of your taste. The number represents the unique color for the web (consult an HTML book for colors.)
- Customize the WEBTOPICLIST variable to contain the web specific links you prefer.
- Optional: Set the WEBCOPYRIGHT variable to have a web-specific copyright text (at the bottom of each topic).
- If needed, create customized templates in the new templates directory. (Non existing templates are inherited from
twiki/templates
)
- If you want to use a category table, copy the three files
twikicatitems.tmpl
, twikicatedit.tmpl
and twikicatview.tmpl
from the twiki/templates/Know
directory to the new templates directory, and customize it. The TWiki Category Table section has more.
- In case you want usage statistics for this web: Copy file
WebStatistics.txt
from the twiki/data/Main
directory to the new data directory. Edit topic WebStatistics in the new web and delete old usage entries.
Here are contents of directories with file permissions. Please note that this is for debugging reasons only and does not exactly reflect the distribution:
directory twiki/bin
:
drwxr-xr-x 2 twiki twiki 1024 Feb 18 18:31 .
drwxr-xr-x 8 twiki twiki 1024 Feb 26 04:20 ..
-rw-rw-r-- 1 twiki twiki 770 Feb 10 12:10 .htaccess
-rw-r-xr-x 1 twiki twiki 3968 Feb 18 00:26 attach
-rwxr-xr-x 1 twiki twiki 3033 Feb 17 23:57 changes
-rw-r-xr-x 1 twiki twiki 1377 Feb 8 18:18 delete
-rw-r-xr-x 1 twiki twiki 8785 Feb 17 23:58 edit
-rwxr--r-- 1 twiki twiki 1811 Feb 4 14:31 geturl
-rwxr-xr-x 1 twiki twiki 5047 Feb 8 20:33 mailnotify
-rw-r-xr-x 1 twiki twiki 1825 Feb 8 18:29 oops
-rw-r-xr-x 1 twiki twiki 6932 Feb 11 02:06 preview
-rw-r-xr-x 1 twiki twiki 7804 Feb 17 23:59 rdiff
-rw-r-xr-x 1 twiki twiki 7010 Feb 18 00:03 register
-rw-r-xr-x 1 twiki twiki 2501 Jan 25 19:39 save
-rwxr-xr-x 1 twiki twiki 1778 Feb 18 00:04 search
-rw-r-xr-x 1 twiki twiki 9810 Feb 8 18:43 statistics
-rwxr-xr-x 1 twiki twiki 509 Feb 7 18:55 testenv
-rw-r-xr-x 1 twiki twiki 6856 Feb 18 00:11 upload
-rw-r-xr-x 1 twiki twiki 4922 Feb 17 23:54 view
-rw-r-xr-x 1 twiki twiki 1606 May 21 1999 viewfile
-rw-r-xr-x 1 twiki twiki 27794 Feb 26 06:03 wiki.pm
-rw-r-xr-x 1 twiki twiki 10143 Feb 27 04:03 wikicfg.pm
-rw-r-xr-x 1 twiki twiki 5440 Feb 7 04:36 wikisearch.pm
directory twiki/templates/
:
drwxr-xr-x 7 twiki twiki 1024 Jan 16 19:39 .
drwxr-xr-x 8 twiki twiki 1024 Feb 26 04:20 ..
drwxr-xr-x 2 twiki twiki 1024 Jun 8 1999 Know
drwxr-xr-x 2 twiki twiki 1024 Dec 9 1998 Main
-rw-r--r-- 1 twiki twiki 2286 Feb 24 21:50 attach.tmpl
-rw-r--r-- 1 twiki twiki 1272 Feb 8 16:07 attachtable.tmpl
-rw-r--r-- 1 twiki twiki 1884 Feb 24 21:54 changes.tmpl
-rw-r--r-- 1 twiki twiki 2242 Feb 24 21:33 edit.tmpl
-rw-r--r-- 1 twiki twiki 965 Feb 8 16:07 mailnotify.tmpl
-rw-r--r-- 1 twiki twiki 30 Jan 14 1999 notedited.tmpl
-rw-r--r-- 1 twiki twiki 934 Feb 8 16:07 notext.tmpl
-rw-r--r-- 1 twiki twiki 899 Feb 8 16:07 notwiki.tmpl
-rw-r--r-- 1 twiki twiki 299 Feb 24 21:58 noweb.tmpl
-rw-r--r-- 1 twiki twiki 957 Feb 24 22:17 oops.tmpl
-rw-r--r-- 1 twiki twiki 871 Feb 24 22:17 oopsdel.tmpl
-rw-r--r-- 1 twiki twiki 1330 Feb 24 22:17 oopslocked.tmpl
-rw-r--r-- 1 twiki twiki 1024 Feb 24 22:17 oopsregexist.tmpl
-rw-r--r-- 1 twiki twiki 912 Feb 24 22:17 oopsregpasswd.tmpl
-rw-r--r-- 1 twiki twiki 923 Feb 24 22:17 oopsregrequ.tmpl
-rw-r--r-- 1 twiki twiki 1125 Feb 24 22:17 oopsregthanks.tmpl
-rw-r--r-- 1 twiki twiki 942 Feb 24 22:17 oopsregwiki.tmpl
-rw-r--r-- 1 twiki twiki 1564 Feb 24 22:17 oopsrev.tmpl
-rw-r--r-- 1 twiki twiki 906 Feb 24 22:17 oopsupload.tmpl
-rw-r--r-- 1 twiki twiki 1535 Feb 24 22:02 preview.tmpl
-rw-r--r-- 1 twiki twiki 1661 Feb 24 22:04 rdiff.tmpl
-rw-r--r-- 1 twiki twiki 263 Aug 3 1999 register.tmpl
-rw-r--r-- 1 twiki twiki 936 Feb 8 16:08 registernotify.tmpl
-rw-r--r-- 1 twiki twiki 1779 Feb 24 22:06 search.tmpl
-rw-r--r-- 1 twiki twiki 1533 Feb 24 21:43 view.tmpl
directory twiki/templates/Main
:
drwxr-xr-x 2 twiki twiki 1024 Dec 9 1998 .
drwxr-xr-x 7 twiki twiki 1024 Jan 16 19:39 ..
-rw-r--r-- 1 twiki twiki 2732 Feb 24 21:34 edit.tmpl
directory twiki/templates/Know
(has a TWiki Category Table) :
drwxr-xr-x 2 twiki twiki 1024 Jun 8 1999 .
drwxr-xr-x 7 twiki twiki 1024 Jan 16 19:39 ..
-rw-rw-r-- 1 twiki twiki 446 Jun 8 1999 notedited.tmpl
-rw-rw-r-- 1 twiki twiki 206 Jun 8 1999 twikicatedit.tmpl
-rw-rw-r-- 1 twiki twiki 1060 Jul 16 1999 twikicatitems.tmpl
-rw-rw-r-- 1 twiki twiki 231 Jun 8 1999 twikicatview.tmpl
directory twiki/data/
:
drwxrwxrwx 8 twiki twiki 1024 Feb 26 04:17 .
drwxr-xr-x 8 twiki twiki 1024 Feb 26 04:20 ..
-rw-r--r-- 1 nobody nobody 2241 Feb 25 20:18 .htpasswd
drwxrwxrwx 2 twiki twiki 3072 Feb 27 01:15 Know
drwxrwxrwx 2 twiki twiki 9216 Feb 27 18:16 Main
-rw-rw-rw- 1 twiki twiki 1 Feb 26 06:01 debug.txt
-rw-r--r-- 1 nobody nobody 1263064 Jan 31 23:13 log200001.txt
-rw-r--r-- 1 nobody nobody 1063398 Feb 27 18:33 log200002.txt
part of directory twiki/data/Main
:
drwxrwxrwx 2 twiki twiki 9216 Feb 27 18:16 .
drwxrwxrwx 8 twiki twiki 1024 Feb 26 04:17 ..
-rw-rw-rw- 1 twiki twiki 5722 Feb 27 18:13 .changes
-rw-rw-rw- 1 twiki twiki 9 Feb 27 18:15 .mailnotify
-rw-r--r-- 1 nobody nobody 26163 Feb 24 12:22 TWikiDocumentation.txt
-r--r--r-- 1 nobody nobody 44133 Feb 24 12:22 TWikiDocumentation.txt,v
-rw-r--r-- 1 nobody nobody 11661 Feb 27 18:13 TWikiHistory.txt
-r--r--r-- 1 nobody nobody 18877 Feb 27 18:13 TWikiHistory.txt,v
-rw-r--r-- 1 nobody nobody 3029 Feb 26 04:46 TWikiPreferences.txt
-r--r--r-- 1 nobody nobody 3219 Feb 26 04:46 TWikiPreferences.txt,v
-rw-r--r-- 1 nobody nobody 7188 Feb 11 21:39 TWikiRegistration.txt
-r--r--r-- 1 nobody nobody 7375 Feb 11 21:39 TWikiRegistration.txt,v
-rw-r--r-- 1 nobody nobody 3180 Feb 25 20:19 TWikiUsers.txt
-r--r--r-- 1 nobody nobody 16537 Feb 25 20:19 TWikiUsers.txt,v
-rw-r--r-- 1 nobody nobody 2613 Feb 7 04:47 TWikiVariables.txt
-r--r--r-- 1 nobody nobody 3125 Feb 7 04:47 TWikiVariables.txt,v
-rw-r--r-- 1 nobody nobody 2068 Feb 10 11:34 TWikiWeb.txt
-r--r--r-- 1 nobody nobody 3610 Feb 10 11:34 TWikiWeb.txt,v
-rw-r--r-- 1 nobody nobody 1677 Feb 26 05:11 TWikiWebsTable.txt
-r--r--r-- 1 nobody nobody 1866 Feb 26 05:11 TWikiWebsTable.txt,v
-rw-r--r-- 1 nobody nobody 2294 Feb 27 17:54 WebHome.txt
-r--r--r-- 1 nobody nobody 5282 Feb 27 17:54 WebHome.txt,v
-rw-r--r-- 1 nobody nobody 586 Jan 17 01:05 WebNotify.txt
-r--r--r-- 1 nobody nobody 1629 Jan 17 01:05 WebNotify.txt,v
-rw-r--r-- 1 nobody nobody 1834 Feb 25 14:13 WebPreferences.txt
-r--r--r-- 1 nobody nobody 2023 Feb 25 14:13 WebPreferences.txt,v
-rw-r--r-- 1 nobody nobody 4407 Feb 11 21:08 WebSearch.txt
-r--r--r-- 1 nobody nobody 10822 Feb 11 21:08 WebSearch.txt,v
-rw-r--r-- 1 nobody nobody 4416 Feb 27 00:00 WebStatistics.txt
-r--r--r-- 1 nobody nobody 27759 Feb 27 00:00 WebStatistics.txt,v
directory twiki/pub/
:
drwxrwxrwx 11 twiki twiki 1024 Feb 8 18:10 .
drwxr-xr-x 8 twiki twiki 1024 Feb 26 04:20 ..
drwxrwxrwx 4 nobody nobody 1024 Aug 28 1999 Know
drwxrwxrwx 19 nobody nobody 1024 Feb 27 09:56 Main
-rw-r--r-- 1 twiki twiki 1078 Jan 14 20:24 favicon.ico
drwxr-xr-x 2 twiki twiki 1024 Mar 27 1999 icn
-rw-r--r-- 1 twiki twiki 3016 Sep 10 04:27 twikilogo.gif
-rw-r--r-- 1 twiki twiki 5320 Sep 10 04:27 twikilogo1.gif
-rw-r--r-- 1 twiki twiki 6125 Sep 10 04:27 twikilogo2.gif
-rw-r--r-- 1 twiki twiki 7218 Sep 10 04:27 twikilogo3.gif
-rw-r--r-- 1 twiki twiki 6710 Sep 11 02:21 twikilogo4.gif
-rw-r--r-- 1 twiki twiki 2877 Jun 15 1999 wikiHome.gif
directory twiki/pub/icn/
:
drwxr-xr-x 2 twiki twiki 1024 Mar 27 1999 .
drwxrwxrwx 11 twiki twiki 1024 Feb 8 18:10 ..
-rw-r--r-- 1 twiki twiki 801 Mar 27 1999 _filetypes.txt
-rw-r--r-- 1 twiki twiki 143 Mar 27 1999 bat.gif
-rw-r--r-- 1 twiki twiki 926 Mar 27 1999 bmp.gif
-rw-r--r-- 1 twiki twiki 141 Mar 27 1999 c.gif
-rw-r--r-- 1 twiki twiki 144 Mar 27 1999 dll.gif
-rw-r--r-- 1 twiki twiki 152 Mar 27 1999 doc.gif
-rw-r--r-- 1 twiki twiki 130 Mar 27 1999 else.gif
-rw-r--r-- 1 twiki twiki 876 Mar 27 1999 exe.gif
-rw-r--r-- 1 twiki twiki 147 Mar 27 1999 fon.gif
-rw-r--r-- 1 twiki twiki 142 Mar 27 1999 h.gif
-rw-r--r-- 1 twiki twiki 156 Mar 27 1999 hlp.gif
-rw-r--r-- 1 twiki twiki 186 Mar 27 1999 html.gif
-rw-r--r-- 1 twiki twiki 144 Mar 27 1999 java.gif
-rw-r--r-- 1 twiki twiki 148 Mar 27 1999 mov.gif
-rw-r--r-- 1 twiki twiki 150 Mar 27 1999 pdf.gif
-rw-r--r-- 1 twiki twiki 146 Mar 27 1999 pl.gif
-rw-r--r-- 1 twiki twiki 150 Mar 27 1999 ppt.gif
-rw-r--r-- 1 twiki twiki 148 Mar 27 1999 ps.gif
-rw-r--r-- 1 twiki twiki 148 Mar 27 1999 py.gif
-rw-r--r-- 1 twiki twiki 130 Mar 27 1999 ram.gif
-rw-r--r-- 1 twiki twiki 154 Mar 27 1999 reg.gif
-rw-r--r-- 1 twiki twiki 147 Mar 27 1999 sh.gif
-rw-r--r-- 1 twiki twiki 155 Mar 27 1999 sniff.gif
-rw-r--r-- 1 twiki twiki 149 Mar 27 1999 ttf.gif
-rw-r--r-- 1 twiki twiki 134 Mar 27 1999 txt.gif
-rw-r--r-- 1 twiki twiki 154 Mar 27 1999 wav.gif
-rw-r--r-- 1 twiki twiki 152 Mar 27 1999 wri.gif
-rw-r--r-- 1 twiki twiki 152 Mar 27 1999 xls.gif
-rw-r--r-- 1 twiki twiki 144 Mar 27 1999 zip.gif
-- PeterThoeny - 05 Apr 2000