Package TWiki::Store::RcsFile
This class is PACKAGE PRIVATE to Store, and should never be
used from anywhere else. Base class of implementations of stores
that manipulate RCS format files.
The general contract of the methods on this class and its subclasses
calls for errors to be signalled by Error::Simple exceptions.
Refer to Store.pm for models of usage.
On this page:
- ClassMethod new ($session,$web,$topic,$attachment)
- ObjectMethod getRevisionInfo ($version) -> ($rev,$date,$user,$comment)
- ObjectMethod getLatestRevision () -> $text
- ObjectMethod getLatestRevisionTime () -> $text
- ObjectMethod readMetaData ($name) -> $text
- ObjectMethod getWorkArea ($key) -> $directorypath
- ObjectMethod saveMetaData ($web,$name) -> $text
- ObjectMethod getTopicNames () -> @topics
- ObjectMethod getWebNames () -> @webs
- ObjectMethod searchInWebContent ($searchString,$web,\@topics,\%options) -> \%map
- ObjectMethod moveWeb ($newWeb)
- ObjectMethod getRevision ($version) -> $text
- ObjectMethod storedDataExists () -> $boolean
- ObjectMethod getTimestamp () -> $integer
- ObjectMethod restoreLatestRevision ($wikiname)
- ObjectMethod removeWeb ($web)
- ObjectMethod moveTopic ($newWeb,$newTopic)
- ObjectMethod copyTopic ($newWeb,$newTopic)
- ObjectMethod moveAttachment ($newWeb,$newTopic,$newAttachment)
- ObjectMethod copyAttachment ($newWeb,$newTopic)
- ObjectMethod isAsciiDefault () -> $boolean
- ObjectMethod setLock ($lock,$user)
- ObjectMethod isLocked () -> ($user,$time)
- ObjectMethod setLease ($lease)
- ObjectMethod getLease () -> $lease
- ObjectMethod getStream () -> \*STREAM
- ObjectMethod numRevisions () -> $integer
- ObjectMethod initBinary ()
- ObjectMethod initText ()
- ObjectMethod addRevisionFromText ($text,$comment,$user,$date)
- ObjectMethod addRevisionFromStream ($fh,$comment,$user,$date)
- ObjectMethod replaceRevision ($text,$comment,$user,$date)
- ObjectMethod deleteRevision ()
- ObjectMethod revisionDiff ($rev1,$rev2,$contextLines) -> \@diffArray
- ObjectMethod getRevisionAtTime ($time) -> $rev
- ObjectMethod getAttachmentAttributes ($web,$topic,$attachment)
- ObjectMethod getAttachmentList ($web,$topic)
- ObjectMethod stringify ()
ClassMethod new ($session,$web,$topic,$attachment)
Constructor. There is one object per stored file. Note that $web, $topic and $attachment must be untainted!ObjectMethod getRevisionInfo ($version) -> ($rev,$date,$user,$comment)
-
$version
if 0 or undef, or out of range (version number > number of revs) will return info about the latest revision.
ObjectMethod getLatestRevision () -> $text
Get the text of the most recent revisionObjectMethod getLatestRevisionTime () -> $text
Get the time of the most recent revisionObjectMethod readMetaData ($name) -> $text
Get a meta-data block for this webObjectMethod getWorkArea ($key) -> $directorypath
Gets a private directory uniquely identified by $key. The directory is intended as a work area for plugins. The standard is a directory named the same as "key" under $TWiki::cfg{RCS}{WorkAreaDir}ObjectMethod saveMetaData ($web,$name) -> $text
Write a named meta-data string. If web is given the meta-data is stored alongside a web. ObjectMethod getTopicNames () -> @topics
Get list of all topics in a web -
$web
- Web name, required, e.g.'Sandbox'
( 'WebChanges', 'WebHome', 'WebIndex', 'WebNotify' )
ObjectMethod getWebNames () -> @webs
Gets a list of names of subwebs in the current web
ObjectMethod searchInWebContent ($searchString,$web,\@topics,\%options) -> \%map
Search 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).-
$searchString
- the search string, in egrep format if regex -
$web
- The web to search in -
\@topics
- reference to a list of topics to search -
\%options
- reference to an options hash
\%options
hash may contain the following options: -
type
- ifregex
will perform a egrep-syntax RE search (default '') -
casesensitive
- false to ignore case (defaulkt true) -
files_without_match
- true to return files only (default false)
files_without_match
is specified, it will
return on the first match in each topic (i.e. it will return only one
match per topic, and will not return matching lines).
ObjectMethod moveWeb ($newWeb)
Move a web.ObjectMethod getRevision ($version) -> $text
Get the text for a given revision. The version number must be an integer. Virtual method - must be implemented by subclassesObjectMethod storedDataExists () -> $boolean
Establishes if there is stored data associated with this handler.ObjectMethod getTimestamp () -> $integer
Get the timestamp of the file Returns 0 if no file, otherwise epoch secondsObjectMethod restoreLatestRevision ($wikiname)
Restore the plaintext file from the revision at the head.ObjectMethod removeWeb ($web)
-
$web
- web being removed
ObjectMethod moveTopic ($newWeb,$newTopic)
Move/rename a topic.ObjectMethod copyTopic ($newWeb,$newTopic)
Copy a topic.ObjectMethod moveAttachment ($newWeb,$newTopic,$newAttachment)
Move an attachment from one topic to another. The name is retained.ObjectMethod copyAttachment ($newWeb,$newTopic)
Copy an attachment from one topic to another. The name is retained.ObjectMethod isAsciiDefault () -> $boolean
Check if this file type is known to be an ascii type file.ObjectMethod setLock ($lock,$user)
Set a lock on the topic, if $lock, otherwise clear it. $user is a wikiname. SMELL: there is a tremendous amount of potential for race conditions using this locking approach.ObjectMethod isLocked () -> ($user,$time)
See if a twiki lock exists. Return the lock user and lock time if it does.ObjectMethod setLease ($lease)
-
$lease
reference to lease hash, or undef if the existing lease is to be cleared.
ObjectMethod getLease () -> $lease
Get the current lease on the topic.ObjectMethod getStream () -> \*STREAM
Return a text stream that will supply the text stored in the topic.ObjectMethod numRevisions () -> $integer
Must be provided by subclasses. Find out how many revisions there are. If there is a problem, such as a nonexistent file, returns 0. Virtual method - must be implemented by subclassesObjectMethod initBinary ()
Initialise a binary file. Must be provided by subclasses. Virtual method - must be implemented by subclassesObjectMethod initText ()
Initialise a text file. Must be provided by subclasses. Virtual method - must be implemented by subclassesObjectMethod addRevisionFromText ($text,$comment,$user,$date)
Add new revision. Replace file with text.-
$text
of new revision -
$comment
checkin comment -
$user
is a wikiname. -
$date
in epoch seconds; may be ignored
ObjectMethod addRevisionFromStream ($fh,$comment,$user,$date)
Add new revision. Replace file with contents of stream.-
$fh
filehandle for contents of new revision -
$comment
checkin comment -
$user
is a wikiname. -
$date
in epoch seconds; may be ignored
ObjectMethod replaceRevision ($text,$comment,$user,$date)
Replace the top revision.-
$text
is the new revision -
$date
is in epoch seconds. -
$user
is a wikiname. -
$comment
is a string