Properties

$_params

$_params : array

Hash containing connection parameters.

Type

array

$_vfs

$_vfs : \VFS

VFS object for storing attachments.

Type

\VFS

$_db

$_db : \Horde_Db_Adapter

Handle for the current database connection.

Type

\Horde_Db_Adapter

$_pageNames

$_pageNames : array

A cached list of all available page names.

Type

array

Methods

__construct()

__construct(array  $params = array()) 

Constructor.

Parameters

array $params

A hash containing connection parameters.

getVFS()

getVFS() 

Accessor to manage a VFS instance.

Throws

\Wicked_Exception

retrieveByName()

retrieveByName(string  $pagename) : array

Retrieves the page of a particular name from the database.

Parameters

string $pagename

The name of the page to retrieve.

Throws

\Wicked_Exception

Returns

array

retrieveHistory()

retrieveHistory(string  $pagename, string  $version) : array

Retrieves a historic version of a page.

Parameters

string $pagename

The name of the page to retrieve.

string $version

The version to retrieve.

Throws

\Wicked_Exception

Returns

array —

The page hash.

logPageView()

logPageView(string  $pagename) 

Logs a page view.

Parameters

string $pagename

The page that was viewed.

Throws

\Wicked_Exception

newPage()

newPage(string  $pagename, string  $text) 

Creates a new page.

Parameters

string $pagename

The new page's name.

string $text

The new page's text.

Throws

\Wicked_Exception

updateText()

updateText(  $pagename,   $text,   $changelog) 

Parameters

$pagename
$text
$changelog

renamePage()

renamePage(string  $pagename, string  $newname) 

Renames a page, keeping the page's history.

Parameters

string $pagename

The name of the page to rename.

string $newname

The page's new name.

Throws

\Wicked_Exception

getPageId()

getPageId(  $pagename) 

Parameters

$pagename

getPage()

getPage(  $pagename) 

Parameters

$pagename

getPageById()

getPageById(  $id) 

Parameters

$id

getSpecialPages()

getSpecialPages() 

getPages()

getPages(  $special = true,   $no_cache = false) 

Parameters

$special
$no_cache

pageExists()

pageExists(  $pagename) 

Parameters

$pagename

getAllPages()

getAllPages() 

getHistory()

getHistory(  $pagename) 

Parameters

$pagename

getRecentChanges()

getRecentChanges(integer  $days = 3) : array

Returns the most recently changed pages.

Parameters

integer $days

The number of days to look back.

Throws

\Wicked_Exception

Returns

array —

Pages.

mostRecent()

mostRecent(integer  $limit = 10) : array

Returns the most recently changed pages.

Parameters

integer $limit

The number of most recent pages to return.

Throws

\Wicked_Exception

Returns

array —

Pages.

mostPopular()

mostPopular(integer  $limit = 10) : array

Returns the most popular pages.

Parameters

integer $limit

The number of most popular pages to return.

Throws

\Wicked_Exception

Returns

array —

Pages.

leastPopular()

leastPopular(integer  $limit = 10) : array

Returns the least popular pages.

Parameters

integer $limit

The number of least popular pages to return.

Throws

\Wicked_Exception

Returns

array —

Pages.

searchText()

searchText(string  $searchtext, boolean  $title = true) : array

Finds pages with matches in text or title.

Parameters

string $searchtext

The search expression (Google-like).

boolean $title

Search both page title and text?

Throws

\Wicked_Exception

Returns

array —

A list of pages.

getBackLinks()

getBackLinks(  $pagename) 

Parameters

$pagename

getLikePages()

getLikePages(  $pagename) 

Parameters

$pagename

getAttachedFiles()

getAttachedFiles(string  $pageId, boolean  $allversions = false) : array

Retrieves data on files attached to a page.

Parameters

string $pageId

This is the Id of the page for which we'd like to find attached files.

boolean $allversions

Whether to include all versions. If false or omitted, only the most recent version of each attachment is returned.

Throws

\Wicked_Exception

Returns

array —

An array of key/value arrays describing the attached files.

attachFile()

attachFile(array  $file, string  $data) 

Attaches a file to a page or update an attachment.

Parameters

array $file

This is a key/value array describing the attachment:

'page_id' =>          This is the id of the page to which we would
like to attach the file.
'attachment_name' =>  This is the filename of the attachment.
'change_log' =>       A change log entry for this attach or update
operation.  (Optional)
'change_author' =>    The user uploading this file.  If not present,
the currently logged-in user is assumed.

string $data

This is the contents of the file to be attached.

Throws

\Wicked_Exception

removeAttachment()

removeAttachment(integer  $pageId, string  $attachment, string  $version = null) 

Removes a single version or all versions of an attachment from $pageId.

Parameters

integer $pageId

The Id of the page the file is attached to.

string $attachment

The name of the file.

string $version

If specified, the version to delete. If null, then all versions of $attachment will be removed.

Throws

\Wicked_Exception

removeAllAttachments()

removeAllAttachments(integer  $pageId) 

Removes all attachments from a page.

Parameters

integer $pageId

A page ID.

Throws

\Wicked_Exception

getAttachmentContents()

getAttachmentContents(string  $pageId, string  $filename, string  $version) : string

Retrieves the contents of an attachment.

Parameters

string $pageId

This is the name of the page to which the file is attached.

string $filename

This is the name of the attachment.

string $version

This is the version of the attachment.

Throws

\Wicked_Exception

Returns

string —

The file's contents.

removeVersion()

removeVersion(  $pagename,   $version) 

Parameters

$pagename
$version

removeAllVersions()

removeAllVersions(  $pagename) 

Parameters

$pagename

searchTitles()

searchTitles(string  $searchtext, boolean  $begin = false) : array

Finds pages with matches in the title.

Parameters

string $searchtext

The search expression (Google-like).

boolean $begin

Search only at the begin of the titles?

Throws

\Wicked_Exception

Returns

array —

A list of pages.

getCharset()

getCharset() : string

Returns the charset used by the backend.

Returns

string —

The backend's charset

getMatchingPages()

getMatchingPages(  $searchtext,   $matchType = \Wicked_Page::MATCH_ANY) 

Parameters

$searchtext
$matchType

logAttachmentDownload()

logAttachmentDownload(integer  $pageid, string  $attachment) 

Logs an attachment download.

Parameters

integer $pageid

The page with the attachment.

string $attachment

The attachment name.

Throws

\Wicked_Exception

_attachFile()

_attachFile(array  $file) : integer

Handles the driver-specific portion of attaching a file.

Wicked_Driver::attachFile() calls down to this method for the driver- specific portion, and then uses VFS to store the attachment.

Parameters

array $file

See Wicked_Driver::attachFile().

Throws

\Wicked_Exception

Returns

integer —

The new version of the file attached.

_retrieve()

_retrieve(string  $table, array|string  $where, string  $orderBy = null, integer  $limit = null) : array

Retrieves a set of pages matching an SQL WHERE clause.

Parameters

string $table

Table to retrieve pages from.

array|string $where

Where clause for sql statement (without the 'WHERE'). If an array the 1st element is the clause with placeholder, the 2nd element the values.

string $orderBy

Order results by this column.

integer $limit

Maximum number of pages to fetch.

Throws

\Wicked_Exception

Returns

array —

A list of page hashes.

_convertFromDriver()

_convertFromDriver(mixed  $value) : mixed

Converts a value from the driver's charset to the default charset.

Parameters

mixed $value

A value to convert.

Returns

mixed —

The converted value.

_convertToDriver()

_convertToDriver(mixed  $value) : mixed

Converts a value from the default charset to the driver's charset.

Parameters

mixed $value

A value to convert.

Returns

mixed —

The converted value.