Package =TWiki::Store::RcsFileThis class is PACKAGE PRIVATE to Store, and should never be | ||||||||
Changed: | ||||||||
< < | used from anywhere else. Base class of implementations of stores | |||||||
> > | used from anywhere else. It is the 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)Constructor. There is one object per stored file. Note that $web, $topic and $attachment must be untainted! | ||||||||
Added: | ||||||||
> > | ObjectMethod finish ()Break circular references. | |||||||
ObjectMethod *getRevisionInfo ($version) -> ($rev,$date,$user,$comment)
ObjectMethod *getLatestRevision () -> $textGet the text of the most recent revisionObjectMethod *getLatestRevisionTime () -> $textGet the time of the most recent revision | ||||||||
Deleted: | ||||||||
< < | ObjectMethod readMetaData ($name) -> $textGet a meta-data block for this web | |||||||
ObjectMethod getWorkArea ($key) -> $directorypathGets 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 | ||||||||
Changed: | ||||||||
< < | $TWiki::cfg{RCS}{WorkAreaDir} | |||||||
> > | $TWiki::cfg{WorkingDir}/work_areas | |||||||
Deleted: | ||||||||
< < | ObjectMethod saveMetaData ($web,$name) -> $textWrite 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
( 'WebChanges', 'WebHome', 'WebIndex', 'WebNotify' )
ObjectMethod getWebNames () -> @webs
Gets a list of names of subwebs in the current web
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:
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).
| ||||||||
Added: | ||||||||
> > | ObjectMethod *searchInWebMetaData ($query,\@topics) -> \%matchesSearch for a meta-data expression in the content of a web.$query must be a TWiki::Query object.
Returns a reference to a hash that maps the names of topics that all matched
to the result of the query expression (e.g. if the query expression is
'TOPICPARENT.name' then you will get back a hash that maps topic names
to their parent.
SMELL: this is really inefficient!
| |||||||
ObjectMethod moveWeb ($newWeb)Move a web.ObjectMethod getRevision ($version) -> $textGet the text for a given revision. The version number must be an integer. Virtual method - must be implemented by subclassesObjectMethod *storedDataExists () -> $booleanEstablishes if there is stored data associated with this handler.ObjectMethod getTimestamp () -> $integerGet the timestamp of the file Returns 0 if no file, otherwise epoch seconds | ||||||||
Changed: | ||||||||
< < | ObjectMethod *restoreLatestRevision ($wikiname) | |||||||
> > | ObjectMethod *restoreLatestRevision ($user) | |||||||
Restore the plaintext file from the revision at the head.
ObjectMethod removeWeb ($web)
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 () -> $booleanCheck 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)
ObjectMethod getLease () -> $leaseGet the current lease on the topic.ObjectMethod *removeSpuriousLeases ($web)Remove leases that are not related to a topic. These can get left behind in some store implementations when a topic is created, but never saved.ObjectMethod getStream () -> \*STREAMReturn a text stream that will supply the text stored in the topic.ObjectMethod numRevisions () -> $integerMust 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.
ObjectMethod *addRevisionFromStream ($fh,$comment,$user,$date)Add new revision. Replace file with contents of stream.
ObjectMethod replaceRevision ($text,$comment,$user,$date)Replace the top revision.
ObjectMethod deleteRevision ()Delete the last revision - do nothing if there is only one revision Virtual method - must be implemented by subclassesObjectMethod revisionDiff ($rev1,$rev2,$contextLines) -> \@diffArrayrev2 newer than rev1. Return reference to an array of [ diffType, $right, $left ] Virtual method - must be implemented by subclasses !!!getRevision!!!ObjectMethod *getRevisionAtTime ($time) -> $revGet a single-digit version number for the rev that was alive at the given epoch-secs time, or undef it none could be found. Virtual method - must be implemented by subclassesObjectMethod *getAttachmentAttributes ($web,$topic,$attachment)returns [stat] for any given web, topic, $attachment SMELL - should this return a hash of arbitrary attributes so that SMELL + attributes supported by the underlying filesystem are supported SMELL + (eg: windows directories supporting photo "author", "dimension" fields) | ||||||||
Deleted: | ||||||||
< < | sub _constructAttributesForAutoAttached as long as stat is defined, return an emulated set of attributes for that attachment. | |||||||
ObjectMethod *getAttachmentList ($web,$topic)returns {} of filename => { key => value, key2 => value } for any given web, topic Ignores files starting with _ or ending with ,vObjectMethod stringify ()Generate string representation for debugging | ||||||||
Added: | ||||||||
> > |
ObjectMethod recordChange ($user,$rev,$more)Record that the file changedObjectMethod eachChange ($since) -> $iteratorReturn iterator over changes - see Store for details | |||||||