English Français Deutsch


swRecord is the object for the records of the database. swWiki and swUsers are subclasses of record. It handles inserting, lookup and fields



revision is the unique key for all revisions. It starts as 1 and moves up for each new written record.
name is the name as it is normally displayed. It identifies the page, but not uniquely. The unique keys are the URL representation of the name, that removes all special characters. The current revision is always the highest revision of the name.
user the user that wrote this revision.
timestamp the creation date of the revision
status can be ok, protected and deleted. If the most recent status is deleted, the name is not included in the list of all pages.
content is the content of the page as it is saved as revision.
comment an optional comment when you save a revision.
error shows the error string on lookup or inserting.
encoding is always UTF-8 now.
originalname preserves the original name during parsing, if parser like redirect or displayname change the name of the page.
internalfields is an array of the fields of the page. The structure is an array of keys to a numbered array of values.

insert() all updates create a new revision as insert.
delete() creates a new revision with status deleted.
protect() changes the status from ok to protected. It then can be changed any more. Only users with protect rights can do this.
unprotect() is the reverse process.

lookupLocalName() checks if there is a language subpage of the record and returns it.

lookupName() checks if the name exists. It looks first in current, then in the allurls array of the database to look in revisions. If refresh is used as get in request, then it ignores current and looks always in revisions.

readHeader() reads the first 1000 bytes of the revision to create the index of the database.

lookup() is used normally from outside the object to build the record. It checks first persistance by name. Because persistance deserialize, the object is built immediately. If it is checked by revision, either because the lookup was based on revision or because the lookupName() returned a revision, the file is read from revision and parsed and properties are build.
We have to deal with a bug, that some UTF8 characters are not displayed (apostrophs essentially).

writecurrent() writes the object to persistance into current folder.

writefile() is called by insert, delete, protect and unprotect and writes the revision to a new file. The revision number is asked from the database, but a protection prevents overwriting an existing revision. The revision is finally touched in the database to invoke indexing.
Writefile must also deal to unlink the old revision of the page in the current folder.

File structure inc folder