[Home]DataBase

UseModWiki | RecentChanges | Preferences

UseModWikiDocumentation: Functions - GlobalVariables - DataBase - Actions - System

The UseModWiki database is saved as flat files within the $DataDir. See also /DeveloperQuestions?

An important part of the information processing done by the wiki software is to convert the user's input to presentable HTML. This conversion consists of several steps, and it might be helpful to give names to some of the intermediary formats, especially when whitespace, ampersands and non-ASCII characters are parts of links, page names, file names, and URLs. (Actually, version 0.92 of the UseModWiki software does not support ampersands (&) in page names, so there cannot be a page on "AT&T". Pages like http://susning.nu/AT%26T requires software modifications that are not released.)

  1. User input is plain ASCII (or ISO 8859-1 or your favorite character set). This is the text that is saved in "page" and "keep" files, and the starting point for all format conversion by the WikiToHTML function. Since %xb3 is not escaped, this character (exponential 3 in ISO 8859-1) cannot be part of a wiki page.
  2. HTML escaped text is the result of substituting all &, < and > with &amp; &lt; and &gt; respectively.
  3. Any "free links" given [[inside double brackets]] are converted to normal form by the FreeToNormal function. The "normal" form is the form used for filenames (in the page and keep directories, as described below), and is the basis for URL encoding. It capitalizes the first letter of each word and uses underscores instead of whitespace. The link [[one two three]] is represented by the normal form One_Two_Three. If ampersands in filenames are to be supported, the FreeToNormal function is the place to substitute any &amp; back to a single & (which is a legal character in filenames).
  4. When URLs are emitted as part of the resulting HTML page, the normal form must be URL encoded, which means some special characters should be written as a percent character followed by two hex digits. This is true for ampersand (%26), colon (%3a), and any non-ASCII character (e.g. becomes %f6). Also, any ampersands that are not part of page titles but are part of a script URL should be encoded as &amp; as part of the emitted HTML code. Otherwise it will not pass the W3C HTML validator.

Data Dir

Pages, users

Pages, old versions of pages, and users are saved as text files within the page, keep, and user directories respectively. The files consist of name-data pairs, with $FS1 as the field separator ($FS1 = "\xb3".1).

Each data-field can be a record which uses $FS2 as a field separator ($FS2 = "\xb3".2). These records are called sections.

The sections can have data fields which are records, using, you guessed it, $FS3 as a field separator ($FS3 = "\xb3".3). Text records are the only example of these in the UseModWiki.

Log files

Recent changes and diffs are logged to rclog and diff_log respectively.

rclog consists of records separated by newlines. The records use $FS3 as the field separator.

diff_log

diff_log consists of records separated by "------\n".

Each record is of the form, for example,

 Timeline|1015901043
 38c38
 < 2000 - 2001
 ---
 > 2000 - 2001 - 2002

where "Timeline" is the name of the page, "1015901043" is the time of the diff, and the rest is the output of the unix command

diff old_version new_version.

Related functions include:

config

ConfigVariables are saved in the config text file, which is a perl file.

Pages

Page records are stored in, for example, page/D/DataBase.db

Subpage records are stored in, for example, page/D/DataBase/Subpage.db

If a field begins with "text_", then it is expected to be a Section record with a data field which contains a Text record.

 $Page = {
  	version => 3,    # Data format version
  	revision => 1,   # Number of edited times
  	cache_oldmajor  => 4,
  	cache_oldauthor => 4,
  	cache_diff_default_major => 1,  # =1 is not isEdit
  	cache_diff_default_author => 2, # = 1 if new author, =2 if cache_oldmajor = cache_oldauthor
  	ts_create => 123456217,
   	ts => 123456861, #timestamp, updated every edit
  	text_default => $Section,
 };

Sections

Section records are stored within page and keep-file records.

 $Section = {
      name => 'text_default',
      version => 1,                # Data format version
      id => 1397,                  # userid
      username => 'CliffordAdams',
      ip => '123.123.212.41',      # $ENV{REMOTE_ADDR}
      host => 'is-provider.net',   # inet_aton($ENV{REMOTE_ADDR}), only for real edits, can be slow
      ts => 123456861,             # timestamp
      tscreate => 123456217,       # timestamp of creation, set once at creation
      keepts => 123456861,         # keep timestamp, only used for keep files
      revision => 4,               # number of edits
      data => $Text
   },

Text

Text records are stored within section records where $Section{name} begins with "text_".

They are created by the OpenNewText function.

The text record

 $Text = {
     text => qq|This is some nice wiki text|qq,
     minor => 1,              # minor edit flag
     newauthor => 0,          # = 1 if author unknown/diff from previous edit
     summary => 'Corrected spelling',
 } 

See ExtractingText for some Perl code to do extract this automatically for you.

Keep (Old page versions)

Each record stored in textfile at, for example, keep/D/DataBase.kp

The keep record is a list of unnamed text-section records which have a 'keepts' field.

 $Keep = [
      $Section, # revision 1
      $Section, # revision 2
         ....
 ];

Users

Users are identified both by a numeric "id" and by their printable username. This is messy. Some actions (such as action=edit) that look for an "id" among the CGI variables (identifying the page name) will find the user ID number if no "id" is given in the URL. If the authentication clockwork is refactored in a future version of UseModWiki, I think user "id" should go, and users should be identified by their username only. --Lars Aronsson

Each record stored in textfile at, for example, user/1/1001.db

 $UserData = { 
     username => 'CliffordAdams',
     id  => 1397,
     randkey => 123456789,
     rev => 1, # Data format version
     createtime => 123456220, 
     createip => '123.123.212.41', 
     email => 'rastapop14@hotmail.com',
     password => '123456789',
     notify => 0,
     adminpw => '123456789',
     linkrandom => 0,
     toplinkbar => 0,
     rcdays => 30,
     rcnewtop => 1,
     rcall => 0,
     rcchangehist => 1, 
     editwide => 1,
     norcdiff => 0,
     diffrclink => 1,
     alldiff => 1,
     defaultdiff => 1,
     rcshowedit  => 0,
     tzoffset => 0,
     editrows => 20,
     editcols => 65,
 }

UseModWiki | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited May 13, 2016 5:12 pm by dslb-094-216-139-011.094.216.pools.vodafone-ip.de (diff)
Search: