Elgg  Version master
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Elgg\Database\DbConfig Class Reference

Database configuration service. More...

Public Member Functions

 __construct (\stdClass $config)
 Constructor. More...
 
 getTablePrefix ()
 Get the database table prefix. More...
 
 isDatabaseSplit ()
 Are the read and write connections separate? More...
 
 getConnectionConfig (string $type=self::READ_WRITE)
 Get the connection configuration. More...
 

Static Public Member Functions

static fromElggConfig (Config $config)
 Construct from an Elgg Config. More...
 

Public Attributes

const READ = 'read'
 
const WRITE = 'write'
 
const READ_WRITE = 'readwrite'
 

Protected Member Functions

 getGeneralConnectionConfig ()
 Get the read/write database connection information. More...
 
 getParticularConnectionConfig (string $type)
 Get connection information for reading or writing. More...
 

Protected Attributes

array $db
 
string $dbprefix
 
string $dbhost
 
int $dbport
 
string $dbuser
 
string $dbpass
 
string $dbname
 
string $dbencoding
 

Detailed Description

Database configuration service.

Definition at line 13 of file DbConfig.php.

Constructor & Destructor Documentation

Elgg\Database\DbConfig::__construct ( \stdClass  $config)

Constructor.

Parameters
\stdClass$configObject with keys:
  • db
  • dbprefix
  • dbhost
  • dbport
  • dbuser
  • dbpass
  • dbname
  • dbencoding

Definition at line 72 of file DbConfig.php.

Member Function Documentation

static Elgg\Database\DbConfig::fromElggConfig ( Config  $config)
static

Construct from an Elgg Config.

Parameters
Config$configElgg config
Returns
DbConfig

Definition at line 85 of file DbConfig.php.

Elgg\Database\DbConfig::getConnectionConfig ( string  $type = self::READ_WRITE)

Get the connection configuration.

Note
You must check isDatabaseSplit before using READ or WRITE for $type

The parameters are in an array like this: array( 'host' => 'xxx', 'user' => 'xxx', 'password' => 'xxx', 'database' => 'xxx', 'encoding' => 'xxx', 'prefix' => 'xxx', )

Parameters
string$typeThe connection type: READ, WRITE, READ_WRITE
Returns
array

Definition at line 131 of file DbConfig.php.

Elgg\Database\DbConfig::getGeneralConnectionConfig ( )
protected

Get the read/write database connection information.

Returns
array

Definition at line 153 of file DbConfig.php.

Elgg\Database\DbConfig::getParticularConnectionConfig ( string  $type)
protected

Get connection information for reading or writing.

Parameters
string$typeConnection type: 'write' or 'read'
Returns
array

Definition at line 170 of file DbConfig.php.

Elgg\Database\DbConfig::getTablePrefix ( )

Get the database table prefix.

Returns
string

Definition at line 99 of file DbConfig.php.

Elgg\Database\DbConfig::isDatabaseSplit ( )

Are the read and write connections separate?

Returns
bool

Definition at line 108 of file DbConfig.php.

Member Data Documentation

array Elgg\Database\DbConfig::$db
protected

Definition at line 22 of file DbConfig.php.

string Elgg\Database\DbConfig::$dbencoding
protected

Definition at line 57 of file DbConfig.php.

string Elgg\Database\DbConfig::$dbhost
protected

Definition at line 32 of file DbConfig.php.

string Elgg\Database\DbConfig::$dbname
protected

Definition at line 52 of file DbConfig.php.

string Elgg\Database\DbConfig::$dbpass
protected

Definition at line 47 of file DbConfig.php.

int Elgg\Database\DbConfig::$dbport
protected

Definition at line 37 of file DbConfig.php.

string Elgg\Database\DbConfig::$dbprefix
protected

Definition at line 27 of file DbConfig.php.

string Elgg\Database\DbConfig::$dbuser
protected

Definition at line 42 of file DbConfig.php.

const Elgg\Database\DbConfig::READ = 'read'

Definition at line 15 of file DbConfig.php.

const Elgg\Database\DbConfig::READ_WRITE = 'readwrite'

Definition at line 17 of file DbConfig.php.

const Elgg\Database\DbConfig::WRITE = 'write'

Definition at line 16 of file DbConfig.php.


The documentation for this class was generated from the following file: