NOTE NOTE NOTE if you are working within the TWiki code DO NOT USE THIS FUNCTION FOR GETTING REVISION INFO OF TOPICS - use TWiki::Meta::getRevisionInfo instead. This is essential to allow clean transition to a topic object model later, and avoids the risk of confusion coming from meta and Store revision information being out of step. (it's OK to use it for attachments)
StaticMethod dataEncode ($uncoded) -> $codedEncode meta-data fields, escaping out selected characters. The encoding is chosen to avoid problems with parsing the attribute values, while minimising the number of characters encoded so searches can still work (fairly) sensibly.The encoding has to be exported because TWiki (and plugins) use encoded field data in other places e.g. RDiff, mainly as a shorthand for the properly parsed meta object. Some day we may be able to eliminate that....
StaticMethod dataDecode ($encoded) -> $decodedDecode escapes in a string that was encoded using dataEncodeThe encoding has to be exported because TWiki (and plugins) use encoded field data in other places e.g. RDiff, mainly as a shorthand for the properly parsed meta object. Some day we may be able to eliminate that....
ObjectMethod saveTopic ($user,$web,$topic,$text,$meta,$options)
$options may include:
Save a new revision of the topic, calling plugins handlers as appropriate.
ObjectMethod saveAttachment ($web,$topic,$attachment,$user,$opts)
$opts may include:
Saves a new revision of the attachment, invoking plugin handlers as appropriate. If file is not set, this is a properties-only save.
ObjectMethod repRev ($user,$web,$topic,$text,$meta,$options)Replace last (top) revision with different text.Parameters and return value as saveTopic, except
Used to try to avoid the deposition of 'unecessary' revisions, for example where a user quickly goes back and fixes a spelling error. Also provided as a means for administrators to rewrite history (timetravel). It is up to the store implementation if this is different to a normal save or not.
ObjectMethod delRev ($user,$web,$topic,$text,$meta,$options)Parameters and return value as saveTopic. Provided as a means for administrators to rewrite history. Delete last entry in repository, restoring the previous revision. It is up to the store implementation whether this actually does delete a revision or not; some implementations will simply promote the previous revision up to the head.
ObjectMethod lockTopic ($web,$topic)Grab a topic lock on the given topic. A topic lock will cause other processes that also try to claim a lock to block. A lock has a maximum lifetime of 2 minutes, so operations on a locked topic must be completed within that time. You cannot rely on the lock timeout clearing the lock, though; that should always be done by calling unlockTopic. The best thing to do is to guard the locked section with a try..finally clause. See man Error for more info.
Topic locks are used to make store operations atomic. They are
note the locks used when a topic is edited; those are Leases
(see
ObjectMethod unlockTopic ($user,$web,$topic)Release the topic lock on the given topic. A topic lock will cause other processes that also try to claim a lock to block. It is important to release a topic lock after a guard section is complete. This should normally be done in a 'finally' block. See man Error for more info.
Topic locks are used to make store operations atomic. They are
note the locks used when a topic is edited; those are Leases
(see
ObjectMethod webExists ($web) -> $booleanTest if web exists
A web has to have a home topic to be a web.
ObjectMethod topicExists ($web,$topic) -> $booleanTest if topic exists
ObjectMethod getTopicParent ($web,$topic) -> $stringGet the name of the topic parent. Needs to be fast because of use by Render.pm.
ObjectMethod getTopicLatestRevTime ($web,$topic) -> $epochSecsGet an approximate rev time for the latest rev of the topic. This method is used to optimise searching. Needs to be as fast as possible.
ObjectMethod readMetaData ($web,$name) -> $textRead a named meta-data string. If web is given the meta-data is stored alongside a web.
ObjectMethod saveMetaData ($web,$name) -> $textWrite a named meta-data string. If web is given the meta-data is stored alongside a web.
ObjectMethod getTopicNames ($web) -> @topicsGet list of all topics in a web
( 'WebChanges', 'WebHome', 'WebIndex', 'WebNotify' )
ObjectMethod getListOfWebs ($filter) -> @webNamesGets a list of webs, filtered according to the spec in the $filter, which may include one of:
If $TWiki::cfg{EnableHierarchicalWebs} is set, will also list sub-webs recursively.
ObjectMethod createWeb ($user,$newWeb,$baseWeb,$opts)$newWeb is the name of the new web. $baseWeb is the name of an existing web (a template web). If the base web is a system web, all topics in it will be copied into the new web. If it is a normal web, only topics starting with 'Web' will be copied. If no base web is specified, an empty web (with no topics) will be created. If it is specified but does not exist, an error will be thrown. $opts is a ref to a hash that contains settings to be modified in the web preferences topic in the new web.
ObjectMethod removeWeb ($user,$web)
Destroy a web, utterly. Removed the data and attachments in the web. Use with great care! The web must be a known web to be removed this way.
ObjectMethod getDebugText ($meta,$text) -> $textGenerate a debug text form of the text/meta, for use in debug displays, by annotating the text with meta informtion.
ObjectMethod cleanUpRevID ($rev) -> $integerCleans up (maps) a user-supplied revision ID and converts it to an integer number that can be incremented to create a new revision number. This method should be used to sanitise user-provided revision IDs.
ObjectMethod copyTopic ($user,$fromweb,$fromtopic,$toweb,$totopic)Copy a topic and all it's attendant data from one web to another.SMELL: Does not fix up meta-data!
ObjectMethod searchMetaData ($params) -> $textSearch meta-data associated with topics. Parameters are passed in the $params hash, which may contain:
SMELL: should be replaced with a proper SQL-like search, c.f. DBCacheContrib? .
ObjectMethod searchInWebContent ($searchString,$web,\@topics,\%options) -> \%mapSearch for a string in the content of a web. The search must be over all content and all formatted meta-data, though the latter search type is deprecated (use searchMetaData instead).
\%options hash may contain the following options:
The return value is a reference to a hash which maps each matching topic
name to a list of the lines in that topic that matched the search,
as would be returned by 'grep'. If
ObjectMethod getRevisionAtTime ($web,$topic,$time) -> $rev
Get the revision number of a topic at a specific time. Returns a single-digit rev number or undef if it couldn't be determined (either because the topic isn't that old, or there was a problem)
ObjectMethod getLease ($web,$topic) -> $lease
If there is an lease on the topic, return the lease, otherwise undef.
A lease is a block of meta-information about a topic that can be
recovered (this is a hash containing
ObjectMethod setLease ($web,$topic,$user,$length)Take out an lease on the given topic for this user for $length seconds.
See
ObjectMethod clearLease ($web,$topic)Cancel the current lease.
See
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||