PHP 클래스 ChangeLog, dokuwiki

상속: extends DataObject
파일 보기 프로젝트 열기: splitbrain/dokuwiki 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$cache array
$chunk_size integer
$id string

공개 메소드들

메소드 설명
__construct ( string $id, integer $chunk_size = 8192 ) Constructor
getLastRevisionAt ( number $date_at ) : string Return an existing revision for a specific date which is the current one or younger or equal then the date
getRelativeRevision ( integer $rev, integer $direction ) : boolean | integer Get the nth revision left or right handside for a specific page id and revision (timestamp)
getRevisionInfo ( integer $rev ) : boolean | array Get the changelog information for a specific page id and revision (timestamp)
getRevisions ( integer $first, integer $num ) : array Return a list of page revisions numbers
getRevisionsAround ( integer $rev1, integer $rev2, integer $max = 50 ) : array Returns revisions around rev1 and rev2 When available it returns $max entries for each revision
isCurrentRevision ( integer $rev ) : boolean Check whether given revision is the current page
setChunkSize ( integer $chunk_size ) Set chunk size for file reading Chunk size zero let read whole file at once

보호된 메소드들

메소드 설명
getChangelogFilename ( ) : string Returns path to changelog
getFilename ( ) : string Returns path to current page/media
getNewlinepointer ( resource $fp, integer $finger ) : integer Set pointer to first new line after $finger and return its position
readAdjacentChunk ( resource $fp, integer $head, integer $tail, integer $direction ) : array Returns the next lines of the changelog of the chunck before head or after tail
readChunk ( resource $fp, integer $head, integer $tail ) : array Read chunk and return array with lines of given chunck.
readloglines ( integer $rev ) : array | false Returns lines from changelog.
retrieveRevisionsAround ( integer $rev, integer $max ) : boolean | array Collect the $max revisions near to the timestamp $rev

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( string $id, integer $chunk_size = 8192 )
$id string page id
$chunk_size integer maximum block size read from file

getChangelogFilename() 추상적인 보호된 메소드

Returns path to changelog
abstract protected getChangelogFilename ( ) : string
리턴 string path to file

getFilename() 추상적인 보호된 메소드

Returns path to current page/media
abstract protected getFilename ( ) : string
리턴 string path to file

getLastRevisionAt() 공개 메소드

Return an existing revision for a specific date which is the current one or younger or equal then the date
public getLastRevisionAt ( number $date_at ) : string
$date_at number timestamp
리턴 string revision ('' for current)

getNewlinepointer() 보호된 메소드

Set pointer to first new line after $finger and return its position
protected getNewlinepointer ( resource $fp, integer $finger ) : integer
$fp resource filepointer
$finger integer a pointer
리턴 integer pointer

getRelativeRevision() 공개 메소드

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.
public getRelativeRevision ( integer $rev, integer $direction ) : boolean | integer
$rev integer revision timestamp used as startdate (doesn't need to be revisionnumber)
$direction integer give position of returned revision with respect to $rev; positive=next, negative=prev
리턴 boolean | integer timestamp of the requested revision otherwise false

getRevisionInfo() 공개 메소드

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.
저자: Ben Coburn ([email protected])
저자: Kate Arzamastseva ([email protected])
public getRevisionInfo ( integer $rev ) : boolean | array
$rev integer revision timestamp
리턴 boolean | array false or array with entries: - date: unix timestamp - ip: IPv4 address (127.0.0.1) - type: log line type - id: page id - user: user name - sum: edit summary (or action reason) - extra: extra data (varies by line type)

getRevisions() 공개 메소드

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.
저자: Ben Coburn ([email protected])
저자: Kate Arzamastseva ([email protected])
public getRevisions ( integer $first, integer $num ) : array
$first integer skip the first n changelog lines
$num integer number of revisions to return
리턴 array with the revision timestamps

getRevisionsAround() 공개 메소드

Returns revisions around rev1 and rev2 When available it returns $max entries for each revision
public getRevisionsAround ( integer $rev1, integer $rev2, integer $max = 50 ) : array
$rev1 integer oldest revision timestamp
$rev2 integer newest revision timestamp (0 looks up last revision)
$max integer maximum number of revisions returned
리턴 array with two arrays with revisions surrounding rev1 respectively rev2

isCurrentRevision() 공개 메소드

Check whether given revision is the current page
public isCurrentRevision ( integer $rev ) : boolean
$rev integer timestamp of current page
리턴 boolean true if $rev is current revision, otherwise false

readAdjacentChunk() 보호된 메소드

Returns the next lines of the changelog of the chunck before head or after tail
protected readAdjacentChunk ( resource $fp, integer $head, integer $tail, integer $direction ) : array
$fp resource filepointer
$head integer position head of last chunk
$tail integer position tail of last chunk
$direction integer positive forward, negative backward
리턴 array with entries: - $lines: changelog lines of readed chunk - $head: head of chunk - $tail: tail of chunk

readChunk() 보호된 메소드

Has no check if $head and $tail are really at a new line
protected readChunk ( resource $fp, integer $head, integer $tail ) : array
$fp resource resource filepointer
$head integer start point chunck
$tail integer end point chunck
리턴 array lines read from chunck

readloglines() 보호된 메소드

If file larger than $chuncksize, only chunck is read that could contain $rev.
protected readloglines ( integer $rev ) : array | false
$rev integer revision timestamp
리턴 array | false if success returns array(fp, array(changeloglines), $head, $tail, $eof) where fp only defined for chuck reading, needs closing. otherwise false

retrieveRevisionsAround() 보호된 메소드

Collect the $max revisions near to the timestamp $rev
protected retrieveRevisionsAround ( integer $rev, integer $max ) : boolean | array
$rev integer revision timestamp
$max integer maximum number of revisions to be returned
리턴 boolean | array return array with entries: - $requestedrevs: array of with $max revision timestamps - $revs: all parsed revision timestamps - $fp: filepointer only defined for chuck reading, needs closing. - $lines: non-parsed changelog lines before the parsed revisions - $head: position of first readed changelogline - $lasttail: position of end of last readed changelogline otherwise false

setChunkSize() 공개 메소드

Set chunk size for file reading Chunk size zero let read whole file at once
public setChunkSize ( integer $chunk_size )
$chunk_size integer maximum block size read from file

프로퍼티 상세

$cache 보호되어 있는 프로퍼티

protected array $cache
리턴 array

$chunk_size 보호되어 있는 프로퍼티

protected int $chunk_size
리턴 integer

$id 보호되어 있는 프로퍼티

protected string $id
리턴 string