[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/ChangeLog/ -> ChangeLogTrait.php (summary)

Provides methods for handling of changelog

File Size: 262 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 8 functions

  parseLogLine()
  buildLogLine()
  hasRevisions()
  setChunkSize()
  readloglines()
  readChunk()
  getNewlinepointer()
  readAdjacentChunk()

Functions
Functions that are not part of a class:

parseLogLine($line)   X-Ref
Parses a changelog line into its components

return: array|bool parsed line or false
author: Ben Coburn <btcoburn@silicodon.net>
param: string $line changelog line

buildLogLine(array &$info, $timestamp = null)   X-Ref
Build a changelog line from its components

return: string changelog line
param: array $info Revision info structure
param: int $timestamp log line date (optional)

hasRevisions()   X-Ref
Checks if the ID has old revisions

return: boolean

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

readloglines($rev)   X-Ref
Returns lines from changelog.
If file larger than $chunk_size, only chunk is read that could contain $rev.

When reference timestamp $rev is outside time range of changelog, readloglines() will return
lines in first or last chunk, but they obviously does not contain $rev.

return: array|false
param: int $rev revision timestamp

readChunk($fp, $head, $tail)   X-Ref
Read chunk and return array with lines of given chunk.
Has no check if $head and $tail are really at a new line

return: array lines read from chunk
param: resource $fp resource file pointer
param: int $head start point chunk
param: int $tail end point chunk

getNewlinepointer($fp, $finger)   X-Ref
Set pointer to first new line after $finger and return its position

return: int pointer
param: resource $fp file pointer
param: int $finger a pointer

readAdjacentChunk($fp, $head, $tail, $direction)   X-Ref
Returns the next lines of the changelog  of the chunk before head or after tail

return: array with entries:
param: resource $fp file pointer
param: int $head position head of last chunk
param: int $tail position tail of last chunk
param: int $direction positive forward, negative backward