Class Wicked_Driver_sql

Description

Wicked storage implementation for PHP's PEAR database abstraction layer.

Required values for $params:

      'phptype'       The database type (e.g. 'pgsql', 'mysql', etc.).
      'hostspec'      The hostname of the database server.
      'protocol'      The communication protocol ('tcp', 'unix', etc.).
      'username'      The username with which to connect to the database.
      'password'      The password associated with 'username'.
      'database'      The name of the database.
      'table'         The name of the tasks table in 'database'.
      'charset'       The database's internal charset.

Required by some database implementations:

      'options'       Additional options to pass to the database.
      'tty'           The TTY on which to connect to the database.
      'port'          The port on which to connect to the database.

The table structure can be created by the scripts/drivers/wicked_foo.sql script.

Located in /lib/Driver/sql.php (line 37)

Wicked_Driver
   |
   --Wicked_Driver_sql
Variable Summary
 DB $_db
Method Summary
 Wicked_Driver_sql Wicked_Driver_sql ([array $params = array()])
 boolean connect ()
 void getAllPages ()
 mixed getAttachedFiles (string $pageId, [boolean $allversions = false])
 void getBackLinks ( $pagename)
 string getCharset ()
 void getHistory ( $pagename)
 void getLikePages ( $pagename)
 void getMatchingPages ( $searchtext, [ $matchType = WICKED_PAGE_MATCH_ANY])
 void getPage ( $pagename)
 void getPageById ( $id)
 void getPages ([ $special = true], [ $no_cache = false])
 mixed getRecentChanges ([integer $days = 3])
 mixed leastPopular ([integer $limit = 10])
 mixed logPageView (string $pagename)
 mixed mostPopular ([integer $limit = 10])
 mixed newPage (string $pagename, string $text)
 boolean|PEAR_Error removeAllAttachments (integer $pageId)
 void removeAllVersions ( $pagename)
 boolean|PEAR_Error removeAttachment (integer $pageId, string $attachment, [string $version = null])
 void removeVersion ( $pagename,  $version)
 mixed renamePage (string $pagename, string $newname)
 mixed retrieveByName (string $pagename)
 array retrieveHistory (string $pagename, string $version)
 array searchText (string $searchtext, [boolean $title = true])
 void searchTitles ( $searchtext)
 void updateText ( $pagename,  $text,  $changelog,  $minorchange)
 boolean _attachFile (array $file)
 mixed _convertFromDriver (mixed $value)
 mixed _convertToDriver (mixed $value)
 void _getAttachedFiles_usort ( $a,  $b)
Variables
DB $_db (line 44)

Handle for the current database connection.

Inherited Variables

Inherited from Wicked_Driver

Wicked_Driver::$_params
Wicked_Driver::$_vfs
Methods
Constructor Wicked_Driver_sql (line 51)

Constructs a new Wicked SQL driver object.

Wicked_Driver_sql Wicked_Driver_sql ([array $params = array()])
  • array $params: A hash containing connection parameters.
connect (line 983)

Attempts to open a persistent connection to the SQL server.

  • return: True on success, PEAR_Error on failure.
boolean connect ()
getAllPages (line 115)
void getAllPages ()

Redefinition of:
Wicked_Driver::getAllPages()
getAttachedFiles (line 330)

Retrieves data on files attached to a page.

  • return: An array of key/value arrays describing the attached files or a PEAR_Error:: instance on failure.
mixed getAttachedFiles (string $pageId, [boolean $allversions = false])
  • 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.

Redefinition of:
Wicked_Driver::getAttachedFiles()
Retrieves data on files attached to a page.
getBackLinks (line 218)
void getBackLinks ( $pagename)
  • $pagename

Redefinition of:
Wicked_Driver::getBackLinks()
getCharset (line 949)

Returns the charset used by the backend.

  • return: The backend's charset
string getCharset ()

Redefinition of:
Wicked_Driver::getCharset()
Returns the charset used by the backend.
getHistory (line 120)
void getHistory ( $pagename)
  • $pagename

Redefinition of:
Wicked_Driver::getHistory()
getLikePages (line 274)
void getLikePages ( $pagename)
  • $pagename

Redefinition of:
Wicked_Driver::getLikePages()
getMatchingPages (line 249)
void getMatchingPages ( $searchtext, [ $matchType = WICKED_PAGE_MATCH_ANY])
  • $searchtext
  • $matchType
getPage (line 103)
void getPage ( $pagename)
  • $pagename

Redefinition of:
Wicked_Driver::getPage()
getPageById (line 109)
void getPageById ( $id)
  • $id

Redefinition of:
Wicked_Driver::getPageById()
getPages (line 738)
void getPages ([ $special = true], [ $no_cache = false])
  • $special
  • $no_cache

Redefinition of:
Wicked_Driver::getPages()
getRecentChanges (line 135)

Returns the most recently changed pages.

  • return: An array of pages, or PEAR_Error on failure.
mixed getRecentChanges ([integer $days = 3])
  • integer $days: The number of days to look back.

Redefinition of:
Wicked_Driver::getRecentChanges()
Returns the most recently changed pages.
leastPopular (line 171)

Returns the least popular pages.

  • return: An array of pages, or PEAR_Error on failure.
mixed leastPopular ([integer $limit = 10])
  • integer $limit: The number of least popular pages to return.

Redefinition of:
Wicked_Driver::leastPopular()
Returns the least popular pages.
logPageView (line 551)

Log a hit to $pagename.

  • return: True or PEAR_Error on failure.
mixed logPageView (string $pagename)
  • string $pagename: The page that was viewed.

Redefinition of:
Wicked_Driver::logPageView()
Logs a hit to $pagename.
mostPopular (line 159)

Returns the most popular pages.

  • return: An array of pages, or PEAR_Error on failure.
mixed mostPopular ([integer $limit = 10])
  • integer $limit: The number of most popular pages to return.

Redefinition of:
Wicked_Driver::mostPopular()
Returns the most popular pages.
newPage (line 571)

Creates a new page.

  • return: True, or PEAR_Error on failure.
mixed newPage (string $pagename, string $text)
  • string $pagename: The new page's name.
  • string $text: The new page's text.

Redefinition of:
Wicked_Driver::newPage()
Creates a new page.
removeAllAttachments (line 429)

Removes all attachments from $pageId. Calls parent::removeAllAttachments() to delete files from VFS.

  • return: Either true or a PEAR_Error describing failure.
boolean|PEAR_Error removeAllAttachments (integer $pageId)
  • integer $pageId: The Id of the page to remove attachments from.

Redefinition of:
Wicked_Driver::removeAllAttachments()
Removes all attachments to $pageId from the VFS backend.
removeAllVersions (line 850)
void removeAllVersions ( $pagename)
  • $pagename

Redefinition of:
Wicked_Driver::removeAllVersions()
removeAttachment (line 380)

Remove a single version or all versions of an attachment from $pageId. Calls parent::removeAttachment() to delete files from VFS.

  • return: Either true or a PEAR_Error describing failure.
boolean|PEAR_Error removeAttachment (integer $pageId, string $attachment, [string $version = null])
  • 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.

Redefinition of:
Wicked_Driver::removeAttachment()
Remove a single version or all versions of an attachment to $pageId from the VFS backend.
removeVersion (line 763)
void removeVersion ( $pagename,  $version)
  • $pagename
  • $version

Redefinition of:
Wicked_Driver::removeVersion()
renamePage (line 635)

Rename a page (and keep the page's history).

  • return: True or PEAR_Error on failure.
mixed renamePage (string $pagename, string $newname)
  • string $pagename: The name of the page to rename.
  • string $newname: The page's new name.

Redefinition of:
Wicked_Driver::renamePage()
retrieveByName (line 63)

Retrieves the page of a particular name from the database.

  • return: True on success, PEAR_Error on failure.
mixed retrieveByName (string $pagename)
  • string $pagename: The name of the page to retrieve.

Redefinition of:
Wicked_Driver::retrieveByName()
Retrieves the page of a particular name from the database.
retrieveHistory (line 88)

Retrieves a historic version of a page.

  • return: The page hash, or PEAR_Error on failure.
array retrieveHistory (string $pagename, string $version)
  • string $pagename: The name of the page to retrieve.
  • string $version: The version to retrieve.

Redefinition of:
Wicked_Driver::retrieveHistory()
Retrieves a historic version of a page.
searchText (line 194)

Finds pages with matches in text or title.

  • return: A list of pages, or PEAR_Error on failure.
array searchText (string $searchtext, [boolean $title = true])
  • string $searchtext: The search expression (Google-like).
  • boolean $title: default true If true, both page title and text are searched. If false, only page text is searched.

Redefinition of:
Wicked_Driver::searchText()
Finds pages with matches in text or title.
searchTitles (line 176)
void searchTitles ( $searchtext)
  • $searchtext

Redefinition of:
Wicked_Driver::searchTitles()
updateText (line 675)
void updateText ( $pagename,  $text,  $changelog,  $minorchange)
  • $pagename
  • $text
  • $changelog
  • $minorchange

Redefinition of:
Wicked_Driver::updateText()
_attachFile (line 474)

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.

  • return: The new version of the file attached, or a PEAR_Error:: instance on failure.
  • access: protected
boolean _attachFile (array $file)
  • array $file: See Wicked_Driver::attachFile().

Redefinition of:
Wicked_Driver::_attachFile()
Handles the driver-specific portion of attaching a file.
_convertFromDriver (line 961)

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

  • return: The converted value.
mixed _convertFromDriver (mixed $value)
  • mixed $value: A value to convert.
_convertToDriver (line 973)

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

  • return: The converted value.
mixed _convertToDriver (mixed $value)
  • mixed $value: A value to convert.
_getAttachedFiles_usort (line 354)
void _getAttachedFiles_usort ( $a,  $b)
  • $a
  • $b

Inherited Methods

Inherited From Wicked_Driver

 Wicked_Driver::Wicked_Driver()
 Wicked_Driver::attachFile()
 Wicked_Driver::factory()
 Wicked_Driver::getAllPages()
 Wicked_Driver::getAttachedFiles()
 Wicked_Driver::getAttachmentContents()
 Wicked_Driver::getBackLinks()
 Wicked_Driver::getCharset()
 Wicked_Driver::getHistory()
 Wicked_Driver::getLikePages()
 Wicked_Driver::getPage()
 Wicked_Driver::getPageById()
 Wicked_Driver::getPageId()
 Wicked_Driver::getPages()
 Wicked_Driver::getRecentChanges()
 Wicked_Driver::getSpecialPages()
 Wicked_Driver::getVFS()
 Wicked_Driver::leastPopular()
 Wicked_Driver::logPageView()
 Wicked_Driver::mostPopular()
 Wicked_Driver::newPage()
 Wicked_Driver::pageExists()
 Wicked_Driver::removeAllAttachments()
 Wicked_Driver::removeAllVersions()
 Wicked_Driver::removeAttachment()
 Wicked_Driver::removeVersion()
 Wicked_Driver::renamePage()
 Wicked_Driver::retrieveByName()
 Wicked_Driver::retrieveHistory()
 Wicked_Driver::searchText()
 Wicked_Driver::searchTitles()
 Wicked_Driver::updateText()
 Wicked_Driver::_attachFile()

Documentation generated on Sun, 30 Jan 2011 05:42:57 +0000 by phpDocumentor 1.4.3