Class IMP_Quota_sql

Description

Implementation of the Quota API for servers keeping quota information in a custom SQL database.

Driver must be configured in imp/config/servers.php. Parameters supported:

 phptype     -- Database type to connect to
 hostspec    -- Database host
 username    -- User name for DB connection
 password    -- Password for DB connection
 database    -- Database name
 query_quota -- SQL query which returns single row/column with user quota
                (in bytes). %u is replaced with current user name, %U with
                the user name without the domain part, %d with the domain.
 query_used  -- SQL query which returns single row/column with user used
                space (in bytes). Placeholders are the same like in
                query_quota.

Example how to reuse Horde's global SQL configuration:

  1.  'quota' => array(
  2.      'driver' => 'sql',
  3.      'params' => array_merge($GLOBALS['conf']['sql'],
  4.                              array('query_quota' => 'SELECT quota FROM quotas WHERE user = ?',
  5.                                    'query_used' => 'SELECT used FROM quotas WHERE user = ?'))
  6.  ),

$Horde: imp/lib/Quota/sql.php,v 1.6.2.5 2009/02/17 17:13:51 chuck Exp $

Copyright 2006-2007 Tomas Simonaitis <haden@homelan.lt> Copyright 2006-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.fsf.org/copyleft/gpl.html.

Located in /lib/Quota/sql.php (line 44)

IMP_Quota
   |
   --IMP_Quota_sql
Variable Summary
 boolean $_connected
 DB $_db
Method Summary
 mixed getQuota ()
 boolean _connect ()
Variables
boolean $_connected = false (line 58)

State of SQL connection.

DB $_db (line 51)

SQL connection object.

Inherited Variables

Inherited from IMP_Quota

IMP_Quota::$_params
Methods
getQuota (line 90)

Returns quota information.

  • return: An associative array: 'limit' => Maximum quota allowed (in bytes), 'usage' => Currently used space (in bytes). PEAR_Error on failure.
mixed getQuota ()

Redefinition of:
IMP_Quota::getQuota()
Get quota information (used/allocated), in bytes.
_connect (line 65)

Connects to the database

  • return: True on success, PEAR_Error on failure.
boolean _connect ()

Inherited Methods

Inherited From IMP_Quota

 IMP_Quota::IMP_Quota()
 IMP_Quota::factory()
 IMP_Quota::getMessages()
 IMP_Quota::getQuota()
 IMP_Quota::singleton()

Documentation generated on Sun, 30 Jan 2011 05:28:18 +0000 by phpDocumentor 1.4.3