PHP Class Wicked_Driver_Sql, horde

Author: Tyler Colbert ([email protected])
Author: Chuck Hagenbuch ([email protected])
Author: Jan Schneider ([email protected])
Inheritance: extends Wicked_Driver
Show file Open project: horde/horde

Protected Properties

Property Type Description
$_db Horde_Db_Adapter Handle for the current database connection.
$_pageNames array A cached list of all available page names.

Public Methods

Method Description
__construct ( array $params = [] ) Constructor.
getAllPages ( )
getAttachedFiles ( string $pageId, boolean $allversions = false ) : array Retrieves data on files attached to a page.
getBackLinks ( $pagename )
getCharset ( ) : string Returns the charset used by the backend.
getHistory ( $pagename )
getLikePages ( $pagename )
getMatchingPages ( $searchtext, $matchType = Wicked_Page::MATCH_ANY )
getPageById ( $id )
getPages ( $special = true, $no_cache = false )
getRecentChanges ( integer $days = 3 ) : array Returns the most recently changed pages.
leastPopular ( integer $limit = 10 ) : array Returns the least popular pages.
logAttachmentDownload ( integer $pageid, string $attachment ) Logs an attachment download.
logPageView ( string $pagename ) Logs a page view.
mostPopular ( integer $limit = 10 ) : array Returns the most popular pages.
mostRecent ( integer $limit = 10 ) : array Returns the most recently changed pages.
newPage ( string $pagename, string $text ) Creates a new page.
removeAllAttachments ( integer $pageId ) Removes all attachments from a page.
removeAllVersions ( $pagename )
removeAttachment ( integer $pageId, string $attachment, string $version = null ) Removes a single version or all versions of an attachment from $pageId.
removeVersion ( $pagename, $version )
renamePage ( string $pagename, string $newname ) Renames a page, keeping the page's history.
retrieveByName ( string $pagename ) : array Retrieves the page of a particular name from the database.
retrieveHistory ( string $pagename, string $version ) : array Retrieves a historic version of a page.
searchText ( string $searchtext, boolean $title = true ) : array Finds pages with matches in text or title.
searchTitles ( string $searchtext, boolean $begin = false ) : array Finds pages with matches in the title.
updateText ( $pagename, $text, $changelog )

Protected Methods

Method Description
_attachFile ( array $file ) : integer Handles the driver-specific portion of attaching a file.
_convertFromDriver ( mixed $value ) : mixed Converts a value from the driver's charset to the default charset.
_convertToDriver ( mixed $value ) : mixed Converts a value from the default charset to the driver's charset.
_retrieve ( string $table, array | string $where, string $orderBy = null, integer $limit = null ) : array Retrieves a set of pages matching an SQL WHERE clause.

Method Details

__construct() public method

Constructor.
public __construct ( array $params = [] )
$params array A hash containing connection parameters.

_attachFile() protected method

Wicked_Driver::attachFile() calls down to this method for the driver- specific portion, and then uses VFS to store the attachment.
protected _attachFile ( array $file ) : integer
$file array See Wicked_Driver::attachFile().
return integer The new version of the file attached.

_convertFromDriver() protected method

Converts a value from the driver's charset to the default charset.
protected _convertFromDriver ( mixed $value ) : mixed
$value mixed A value to convert.
return mixed The converted value.

_convertToDriver() protected method

Converts a value from the default charset to the driver's charset.
protected _convertToDriver ( mixed $value ) : mixed
$value mixed A value to convert.
return mixed The converted value.

_retrieve() protected method

Retrieves a set of pages matching an SQL WHERE clause.
protected _retrieve ( string $table, array | string $where, string $orderBy = null, integer $limit = null ) : array
$table string Table to retrieve pages from.
$where array | string Where clause for sql statement (without the 'WHERE'). If an array the 1st element is the clause with placeholder, the 2nd element the values.
$orderBy string Order results by this column.
$limit integer Maximum number of pages to fetch.
return array A list of page hashes.

getAllPages() public method

public getAllPages ( )

getAttachedFiles() public method

Retrieves data on files attached to a page.
public getAttachedFiles ( string $pageId, boolean $allversions = false ) : array
$pageId string This is the Id of the page for which we'd like to find attached files.
$allversions boolean Whether to include all versions. If false or omitted, only the most recent version of each attachment is returned.
return array An array of key/value arrays describing the attached files.

getCharset() public method

Returns the charset used by the backend.
public getCharset ( ) : string
return string The backend's charset

getHistory() public method

public getHistory ( $pagename )

getLikePages() public method

public getLikePages ( $pagename )

getMatchingPages() public method

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

getPageById() public method

public getPageById ( $id )

getPages() public method

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

getRecentChanges() public method

Returns the most recently changed pages.
public getRecentChanges ( integer $days = 3 ) : array
$days integer The number of days to look back.
return array Pages.

leastPopular() public method

Returns the least popular pages.
public leastPopular ( integer $limit = 10 ) : array
$limit integer The number of least popular pages to return.
return array Pages.

logAttachmentDownload() public method

Logs an attachment download.
public logAttachmentDownload ( integer $pageid, string $attachment )
$pageid integer The page with the attachment.
$attachment string The attachment name.

logPageView() public method

Logs a page view.
public logPageView ( string $pagename )
$pagename string The page that was viewed.

mostPopular() public method

Returns the most popular pages.
public mostPopular ( integer $limit = 10 ) : array
$limit integer The number of most popular pages to return.
return array Pages.

mostRecent() public method

Returns the most recently changed pages.
public mostRecent ( integer $limit = 10 ) : array
$limit integer The number of most recent pages to return.
return array Pages.

newPage() public method

Creates a new page.
public newPage ( string $pagename, string $text )
$pagename string The new page's name.
$text string The new page's text.

removeAllAttachments() public method

Removes all attachments from a page.
public removeAllAttachments ( integer $pageId )
$pageId integer A page ID.

removeAllVersions() public method

public removeAllVersions ( $pagename )

removeAttachment() public method

Removes a single version or all versions of an attachment from $pageId.
public removeAttachment ( integer $pageId, string $attachment, string $version = null )
$pageId integer The Id of the page the file is attached to.
$attachment string The name of the file.
$version string If specified, the version to delete. If null, then all versions of $attachment will be removed.

removeVersion() public method

public removeVersion ( $pagename, $version )

renamePage() public method

Renames a page, keeping the page's history.
public renamePage ( string $pagename, string $newname )
$pagename string The name of the page to rename.
$newname string The page's new name.

retrieveByName() public method

Retrieves the page of a particular name from the database.
public retrieveByName ( string $pagename ) : array
$pagename string The name of the page to retrieve.
return array

retrieveHistory() public method

Retrieves a historic version of a page.
public retrieveHistory ( string $pagename, string $version ) : array
$pagename string The name of the page to retrieve.
$version string The version to retrieve.
return array The page hash.

searchText() public method

Finds pages with matches in text or title.
public searchText ( string $searchtext, boolean $title = true ) : array
$searchtext string The search expression (Google-like).
$title boolean Search both page title and text?
return array A list of pages.

searchTitles() public method

Finds pages with matches in the title.
public searchTitles ( string $searchtext, boolean $begin = false ) : array
$searchtext string The search expression (Google-like).
$begin boolean Search only at the begin of the titles?
return array A list of pages.

updateText() public method

public updateText ( $pagename, $text, $changelog )

Property Details

$_db protected property

Handle for the current database connection.
protected Horde_Db_Adapter $_db
return Horde_Db_Adapter

$_pageNames protected property

A cached list of all available page names.
protected array $_pageNames
return array