[ Index ] |
PHP Cross Reference of DokuWiki |
[Source view] [Print] [Project Stats]
methods for handling of changelog of pages or media files
File Size: | 666 lines (22 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
__construct($id, $chunk_size = 8192) X-Ref |
Constructor param: string $id page id param: int $chunk_size maximum block size read from file |
setChunkSize($chunk_size) X-Ref |
Set chunk size for file reading Chunk size zero let read whole file at once param: int $chunk_size maximum block size read from file |
getRevisionInfo($rev) X-Ref |
Get the changelog information for a specific page id and revision (timestamp) Adjacent changelog lines are optimistically parsed and cached to speed up consecutive calls to getRevisionInfo. For large changelog files, only the chunk containing the requested changelog line is read. param: int $rev revision timestamp author: Ben Coburn <btcoburn@silicodon.net> author: Kate Arzamastseva <pshns@ukr.net> return: bool|array false or array with entries: |
getRevisions($first, $num) X-Ref |
Return a list of page revisions numbers Does not guarantee that the revision exists in the attic, only that a line with the date exists in the changelog. By default the current revision is skipped. The current revision is automatically skipped when the page exists. See $INFO['meta']['last_change'] for the current revision. A negative $first let read the current revision too. For efficiency, the log lines are parsed and cached for later calls to getRevisionInfo. Large changelog files are read backwards in chunks until the requested number of changelog lines are recieved. param: int $first skip the first n changelog lines param: int $num number of revisions to return author: Ben Coburn <btcoburn@silicodon.net> author: Kate Arzamastseva <pshns@ukr.net> return: array with the revision timestamps |
getRelativeRevision($rev, $direction) X-Ref |
Get the nth revision left or right handside for a specific page id and revision (timestamp) For large changelog files, only the chunk containing the reference revision $rev is read and sometimes a next chunck. Adjacent changelog lines are optimistically parsed and cached to speed up consecutive calls to getRevisionInfo. param: int $rev revision timestamp used as startdate (doesn't need to be revisionnumber) param: int $direction give position of returned revision with respect to $rev; positive=next, negative=prev return: bool|int |
getRevisionsAround($rev1, $rev2, $max = 50) X-Ref |
Returns revisions around rev1 and rev2 When available it returns $max entries for each revision param: int $rev1 oldest revision timestamp param: int $rev2 newest revision timestamp (0 looks up last revision) param: int $max maximum number of revisions returned return: array with two arrays with revisions surrounding rev1 respectively rev2 |
hasRevisions() X-Ref |
Checks if the ID has old revisons return: boolean |
readloglines($rev) X-Ref |
Returns lines from changelog. If file larger than $chuncksize, only chunck is read that could contain $rev. param: int $rev revision timestamp return: array|false |
readChunk($fp, $head, $tail) X-Ref |
Read chunk and return array with lines of given chunck. Has no check if $head and $tail are really at a new line param: resource $fp resource filepointer param: int $head start point chunck param: int $tail end point chunck return: array lines read from chunck |
getNewlinepointer($fp, $finger) X-Ref |
Set pointer to first new line after $finger and return its position param: resource $fp filepointer param: int $finger a pointer return: int pointer |
isCurrentRevision($rev) X-Ref |
Check whether given revision is the current page param: int $rev timestamp of current page return: bool true if $rev is current revision, otherwise false |
getLastRevisionAt($date_at) X-Ref |
Return an existing revision for a specific date which is the current one or younger or equal then the date param: number $date_at timestamp return: string revision ('' for current) |
readAdjacentChunk($fp, $head, $tail, $direction) X-Ref |
Returns the next lines of the changelog of the chunck before head or after tail param: resource $fp filepointer param: int $head position head of last chunk param: int $tail position tail of last chunk param: int $direction positive forward, negative backward return: array with entries: |
retrieveRevisionsAround($rev, $max) X-Ref |
Collect the $max revisions near to the timestamp $rev param: int $rev revision timestamp param: int $max maximum number of revisions to be returned return: bool|array |