Differences between revisions 15 and 16
Revision 15 as of 2005-04-19 18:00:47
Size: 4810
Editor: JimClark
Comment: start updating to 1.3
Revision 16 as of 2005-05-29 15:18:16
Size: 5275
Editor: NirSoffer
Comment: fixed eample code
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
 <!> '''Should be update to 1.3'''  <!> '''Should be reviewed'''
Line 3: Line 3:
== Storage == [[TableOfContents]]
Line 5: Line 5:
=== Edit log === = Logs =

== Edit log ==
Line 25: Line 27:
=== Event log === == Event log ==
Line 51: Line 53:
=== Error log === == Error log ==
Line 55: Line 57:
=== Pages === = Pages =
Line 71: Line 73:
request = RequestCLI()
page = Page(request, 'FrontPage')
pagename = 'PageName'
request = RequestCLI('localhost/mywiki', pagename)
page = Page(request, pagename)
Line 75: Line 78:
==== Page Editing ==== == Editing pages programatically ==
Line 79: Line 82:
You can use the `PageEditor._write_file(text)` function to programatically create or edit (save) pages. For example :- You can use the `PageEditor.saveText(text, revision)` function to programatically create or edit (save) pages. For example:
Line 82: Line 85:
# This code is equivalent to editing a page with a browsers and
# replacing the content with 'New text...'. The old revision is saved
# and the edit is logged in the edit-log.
Line 83: Line 90:
from MoinMoin.request import RequestCLI
Line 84: Line 92:
request = RequestCLI()
editor = PageEditor(request,'NewPage')
filename, revision, exists = editor.get_rev()
if exists:
    raise "Page Already Exists"

request.form={} # Workaround - saving the page errors without this
editor.saveText('= Test Header =\nTest Content', 0)
pagename = 'PageName'
request = RequestCLI('localhost/mywiki', pagename)
editor = PageEditor(request, pagename)
text = editor.normalizeText('New text...')
dummy, revision, exists = editor.get_rev()
return editor.saveText(text, revision)
Line 94: Line 100:
See also ScriptMarket/AppendTextScript.

== Editing pages from the shell ==
Line 97: Line 106:
/!\ Warning - using this method bypasses the wiki security, access controls, and revision histories. Use with caution. /!\ Warning - using this method bypasses the wiki security, access controls, and revision history. Use with caution.
Line 103: Line 112:
echo "= Test Header =\nTest Content" > TestPage/revisions/00000001 echo "= Saving page from the shell =\nIs easy :)" > TestPage/revisions/00000001
Line 113: Line 122:
=== Backups === == Backups ==
Line 115: Line 124:
=== User data === = User data =
Line 117: Line 126:
=== Caching === = Caching =

= Discussion =

I updated the pages section, other parts should be reviewed. -- NirSoffer [[DateTime(2005-05-29T15:18:15Z)]]
  • <!> Should be reviewed

TableOfContents

Logs

Edit log

The edit log is a flat file format that records all editing of the wiki. It is stored in wikiname/data/edit-log. Page saves, attachment creation and deletion are all recorded. The following data is saved per edit :-

  • Modified time

    Revision number

    Edit type

    Page Name

    Host Address

    Host name

    Moin user id

    Description of edit

The modified time is UTC, or GMT time, the same as is returned by the Python standard time module.

In the case of an attachment edit, the name of the attachment file is the description of the edit , otherwise it is the comment entered by the user.

In the case of an attachment edit, page revision number is set to 99999999, otherwise it is the current page revision number (more on this later).

The different types of edit are :-

  • SAVE - A page was edited and committed.

  • ATTNEW - A new attachment was linked to the page.

  • ATTDEL - An attachment was deleted from a page.

MoinMoin/logfile/editlog.py handles management of the edit logging.

Event log

The event log is a flat file list which stores HTTP queries to the wiki. It is stored in wikiname/data/event-log. Information stored is:

  • Time of access

    Request type

    Request information

The time of access is UTC, or GMT time, the same as is returned by the Python standard time module.

Request type will be one of :-

  • VIEWPAGE - Show a wiki page.

  • SAVEPAGE - Save an edited wiki page.

The request information contains relevant information for the request type in the form:

  • <attribute_name1>=<attribute_value1>&...&<attribute_nameN>=<attribute_valueN>

Attributes are:

  • pagename - The name of the page requested or being saved.

  • REMOTE_ADDR - The IP of the editing machine.

  • HTTP_USER_AGENT - The name and version number the requesting browser.

  • HTTP_REFERER - Where the page request comes from.

MoinMoin.logfile.eventlog handles the event log.

Error log

The error log is a flat file storing error and warning messages from the system. It is stored in wikiname/data/error.log. This file stores python tracebacks from page errors and deprecation warning messages.

Pages

All information associated with wiki pages is stored in the wikiname/data/pages/ directory. Each page is stored as a separate subdirectory, containing the following elements:

current
A file containing a single number, which is the name of the current revision, eg 00000001. If there is no such revision number, the page is considered deleted.
edit-log

A copy of the information from the main edit-log for this page.

revisions (directory)

stores the current and past versions of the page, exactly as they appear in the edit window in text format. Each page revision is stored in a file named eg 00000001. The current page revision is the one pointed to by the current marker file.

cache (directory)
Internal caching information for system optimizations. If this direcory is not present, it will be created the first time a page is accessed.
attachments (directory)
stores attachments for the page, if any.

MoinMoin/Page.py handles reading and access of wiki pages in Moin. The MoinMoin.Page.Page class can be used to create a read only page for programatic use. e.g. to load the front page of your wiki :-

from MoinMoin.request import RequestCLI
from MoinMoin.Page import Page

pagename = 'PageName'
request = RequestCLI('localhost/mywiki', pagename)
page = Page(request, pagename)

Editing pages programatically

Editing of pages is managed through MoinMoin/PageEditor.py and the MoinMoin.PageEditor.PageEditor class.

You can use the PageEditor.saveText(text, revision) function to programatically create or edit (save) pages. For example:

# This code is equivalent to editing a page with a browsers and
# replacing the content with 'New text...'. The old revision is saved
# and the edit is logged in the edit-log.

from MoinMoin.PageEditor import PageEditor
from MoinMoin.request import RequestCLI

pagename = 'PageName'
request = RequestCLI('localhost/mywiki', pagename)
editor = PageEditor(request, pagename)
text = editor.normalizeText('New text...')
dummy, revision, exists = editor.get_rev()
return editor.saveText(text, revision)

See also ScriptMarket/AppendTextScript.

Editing pages from the shell

An alternative for creating new pages is to do so directly, for example from the unix shell.

/!\ Warning - using this method bypasses the wiki security, access controls, and revision history. Use with caution.

cd ~/mywiki/data/pages/
mkdir TestPage
mkdir TestPage/revisions
echo "= Saving page from the shell =\nIs easy :)" > TestPage/revisions/00000001
echo 00000001 > TestPage/current

Or to remove a page entirely:

cd ~/mywiki/data/pages/
rm -r TestPage

Backups

User data

Caching

Discussion

I updated the pages section, other parts should be reviewed. -- NirSoffer DateTime(2005-05-29T15:18:15Z)


CategoryNeedsReview

MoinMoin: MoinDev/Storage (last edited 2013-05-25 19:15:44 by HSI-KBW-078-042-160-036)