May 22, 2006
Pro Wiki Programming

This introduction on programming the ProWiki script is just developing. It is meant to provide the big picture of the ProWiki cosmos that a developer needs ot become effectve. If you are interested in a special topic, please post your questions or interests, so they get increases priority. -- HelmutLeitner May 22, 2006 12:18 CET



The ProWikiScript is a single Perl script "" which is called by the WebServer software (usually Apache) using the good old CGI (CommonGatewayInterface). It answers HTTP requests, which usually come from a WebBrowser operated by a user on his client computer.

The script name "wiki.cgi" from the URL just soft-links to "" which is kept in a central cgi directory to work for all wikis on your server. If you have a hundred wikis, they typically all run from the same script. If you update the single "" they all have their new release.

The ProWikiScript acts according to the Command requested (often just the name of a WikiPage) and dynamically builds an HTML page which is printed to the standard output which Apache transfers to the client browser to display it.


All requests are logged in wiki specific LogFiles which are completely separated from the Apache log but much richer in information. For example the log line also contains the UserName, the URL, additional parameters (that are not passes by the URL) and overall timing information.

Each wiki has its own log files in its specific DataDir directory. The LogFiles are monthly files "log_YYMM" (e. g. "log_0602" for the February of 2006). They can be kept, deleted or compressed according to the needs of the wiki administrator. ActionStat, ActionLog, ActionTop and CdmlHotspots operate on these files, so at least one month should be available.

There are in addition separate RcLogFiles which follow the same scheme and are named "rclog_YYMM" accordingly. They only log page changes and contain much less data. They are usually kept for all time.

If the ProWikiScript prints "messages" by MsgPrint(...); (information you need for testing, a release should in general not contain such messages) these go to a file "msglog" in DataDir.

If you want to view the exact total output from some request while testing, you can configure the system to produce a file "answer.txt" in DataDir.

Cache Files

CacheFiles are located in the DataDir directory. They exist for performance optimization.

The file "pages" monitors the creation and deletion of pages and categories for efficient creation of folder and index page lists. See e. g. ThisWiki:action=index and FolderFolder.

The file "words" caches pages for WordLinking. See for example these links: Branch or Options.


Pages (or results of commands) have the structure (title, content) and are displayed within the framework of a HTML/CSS TemplateText. The templates contain InsertCommands that are used to specify what information should go where. The TemplateText may be kept in a file or in a WikiPage.

ProWiki can use one template for all pages but could also assign individual templates to Branches (parts of the wiki, even single pages). the variable TemplateFile is used to configure this (see also: WikiContextuality and WikiFractality).

In parallel there are optional TemplateEdit and TemplatePrint variables, in case that simplified templates for editing andor printing are desirable.


Typical for wiki is the conversion of the written markup-decorated content to HTML-decorated text that can be inserted to the template and displayed by the browsers.

There are different types in ProWiki:

  • some HTML that is accepted and passed through (e. g. <u>..</u>)
  • WikiMarkups that work ins single lines (e. g. bold and italic)
  • WikiMarkups that span multiple lines (e. g. for lists)
  • CdmlElements for more complicated layout elements
See also: WikiRenderingProcess

Page storage

WikiPages are store in the "page" subdirectory of the DataDir directory.

WikiPages are stored as normal files. More exactly, there are three files for each page:

  • page/X/pagename.dw -- the pure wiki page content
  • page/X/pagename.db -- the page metadata, containing diffs, dates, userinformation, saved text from last author, ...
  • page/X/pagename.txt_r -- the PageHistory
X is either a single letter, the first letter of the pagename, uppercase (for example "page/F/FrontPage.dw") or the string "other" for pagenames that start with a letter different from "[A-Za-z]" (for example "page/other/12345.dw").

The separation of the content in a separate file means that there is animportant trade-off. It means that there is no difference in accessing some information from a file of from a page (e. g. when storing a template in a wiki page or when doing a full text search through all wiki pages).

Informal user data / Preferences

Informal user data is kept in a "user" subdirectory of the DataDir directory. It is synchronized using a wiki-specific cookie which is long-lived.

Formal user data / registration

Formal user data is kept in a "user" subdirectory of the GlobalDir directory. It is synchronized using a common cookie which is deleted for safety when the browser session ends.

See also / Special Topics

FolderStartingPoints FolderProgramming FolderFiles