Class ConfigDBStorage

Description

Implements interfaces:

Class ConfigDBStorage to store serialized configuration in a table.

Needs a table, create it if not exists using following statement:

  1.  -- {prefixist almost con by default
  2.  CREATE TABLE {prefix}_configdbstorage (
  3.      `id` varchar(32NOT NULL default '' COMMENT 'md5 hash as PK',
  4.      `value` text COMMENT 'Serialized content of configuration',
  5.      PRIMARY KEY (`id`)
  6.  )

Usage:

  1.  // md5 hash of $options['key'] will be used as id in table {prefix}_configdbstorage
  2.  $options['key''/full/path/to/config.php';
  3.  $config ConfigFactory::get('dbstorage'$options);

  • author: Murat Purc <murat@purc.de>
  • todo: Add caching lifetime to table

Located in /contenido/classes/mp/class.confighandler.php (line 236)

ConfigBaseAbstract
   |
   --ConfigDBStorage
Variable Summary
 DB_Contenido $_oDB
 string $_table
Method Summary
 ConfigDBStorage __construct ( $options)
 mixed get ()
 bool remove ()
 bool set ( $content)
Variables
DB_Contenido $_oDB = null (line 242)

Database instance

  • access: private
string $_table = '' (line 248)

Name of table where the configuration is stored

  • access: private

Inherited Variables

Inherited from ConfigBaseAbstract

ConfigBaseAbstract::$_bError
ConfigBaseAbstract::$_key
ConfigBaseAbstract::$_lifetime
Methods
Constructor __construct (line 259)

Constructor of ConfigDBStorage, delegates parameter to parent and sets some properties

  • access: public
ConfigDBStorage __construct ( $options)
  • array $options: Assoziative options array as follows:
    1.  $options['key'Normally full path to configuration filewhere the md5 hash will be calculated

Redefinition of:
ConfigBaseAbstract::__construct()
Constructor of ConfigBaseAbstract, does some checks, stops further script execution if validation of arguments fails.
get (line 272)

Returns the configuration from db table

  • return: PHP variable or nul on error
  • access: public
mixed get ()

Implementation of:
IConfigBase::get()
Method to get configuration, must be overwritten by child.
remove (line 305)

Removes the configuration from table.

  • return: True on success otherwhise false
  • access: public
bool remove ()

Implementation of:
IConfigBase::remove()
Method to remove configuration, must be overwritten by child.
set (line 288)

Serializes and writes passed configuration into the table.

  • return: True on success otherwhise false
  • access: public
bool set ( $content)
  • $content

Implementation of:
IConfigBase::set()
Method to set configuration, must be overwritten by child.

Inherited Methods

Inherited From ConfigBaseAbstract

 ConfigBaseAbstract::__construct()
 ConfigBaseAbstract::getExpires()

Documentation generated on Sun, 08 Feb 2009 22:00:24 +0100 by phpDocumentor 1.4.1