Config Class Reference

Classes that handles general configuration of the systems. More...

List of all members.

Public Member Functions

 Config ()
 Read all default settings from 'Settings.php'.
 setEnvironmentDir ($name_)
 Set the directory where the application is installed.
 getEnvironmentDir ()
 Returns the directory where the application is installed.
 getLogDir ()
 Returns the directory where the general log files are saved.
 getSiteDir ()
 Returns the directory where all sites/dists are installed.
 getSites ()
 Get a list with SiteConfig objects, one for each installed site/dist.
 getSite ($siteName_)
 Get a list with SiteConfig objects, one for each installed site/dist.
 getDBDSN ($configName_)
 Get the dsn name to the database.
 getDbConfig ()
 Get a DbConfig object.

Private Attributes

 $_environmentDir
 See setEnvironmentDir().
 $_dbConfig
 Holds a DbConfig instance Config::getDbConfig()}.
 $_sites
 A list of SiteConfig objects.


Detailed Description

Classes that handles general configuration of the systems.

The directory model we are using at Fareoffice are also controlled by this class. The model looks like the following.

app/Config/ app/Log/

app/Site/www.fareoffice.com/Static/HtDocs app/Site/www.fareoffice.com/Static/PhpInclude app/Site/www.fareoffice.com/Temp/Log app/Site/www.fareoffice.com/Temp/Cache

app/Site/www.customer.com/Static/HtDocs app/Site/www.customer.com/Static/PhpInclude app/Site/www.customer.com/Temp/Log app/Site/www.customer.com/Temp/Cache

Author:
Daniel Lindh <[email protected]> Include files Environment settings for the application server.

Definition at line 35 of file Config.php.


Member Function Documentation

Config::Config (  ) 

Read all default settings from 'Settings.php'.

Definition at line 40 of file Config.php.

References getDbConfig().

00041   {
00042     $dbConfig = $this->getDbConfig();
00043 
00044     include(FAREOFFICE_LIB_ROOT . 'Settings.php');
00045   }

Config::getDbConfig (  ) 

Get a DbConfig object.

The DbConfig object holds all database configurations.

Returns:
dbConfig

Definition at line 148 of file Config.php.

Referenced by Config(), and getDBDSN().

00149   {
00150     if (!is_object($this->dbConfig))
00151     {
00152       $this->dbConfig = new DbConfig();
00153     }
00154 
00155     return $this->dbConfig;
00156   }

Config::getDBDSN ( configName_  ) 

Get the dsn name to the database.

Parameters:
$configName_ - string - The name of the database configuration. For more information see DbConfig::setDSN()
Returns:
array An array with DB DSN info. arr['phptype'] = 'mysql; arr['hostspec'] = '192.168.2.250'; arr['username'] = 'username'; arr['password'] = 'xxx'; arr['database'] = 'foMaster';

Definition at line 136 of file Config.php.

References getDbConfig().

00137   {
00138     return $this->getDbConfig()->getDSN($configName_);
00139   }

Config::getEnvironmentDir (  ) 

Returns the directory where the application is installed.

Ie. '/opt/RootLive/'

Returns:
string

Definition at line 64 of file Config.php.

Referenced by getLogDir(), and getSiteDir().

00065   {
00066     return $this->_environmentDir;
00067   }

Config::getLogDir (  ) 

Returns the directory where the general log files are saved.

Ie. '/opt/RootLive/Log/'

Returns:
string

Definition at line 76 of file Config.php.

References getEnvironmentDir().

00077   {
00078     return $this->getEnvironmentDir() . 'Log/';
00079   }

Config::getSite ( siteName_  ) 

Get a list with SiteConfig objects, one for each installed site/dist.

Returns:
SiteConfig Returns an array with SiteConfig objects.

Definition at line 116 of file Config.php.

References getSites().

00117   {
00118     $siteArr = $this->getSites();
00119     return $siteArr[$siteName_];
00120   }

Config::getSiteDir (  ) 

Returns the directory where all sites/dists are installed.

Ie. '/opt/RootLive/Site/'

Returns:
string

Definition at line 88 of file Config.php.

References getEnvironmentDir().

Referenced by getSites().

00089   {
00090     return $this->getEnvironmentDir() . 'Site/';
00091   }

Config::getSites (  ) 

Get a list with SiteConfig objects, one for each installed site/dist.

Returns:
SiteConfig Returns an array with SiteConfig objects.

Definition at line 98 of file Config.php.

References fileList(), and getSiteDir().

Referenced by getSite().

00099   {
00100     if (!is_array($this->sites))
00101     {
00102       $this->_sites = array();
00103       foreach(fileList($this->getSiteDir(), 'DIR', FALSE) as $site)
00104       {
00105         $this->_sites[basename($site)] = new SiteConfig($site . '/');
00106       }
00107     }
00108     return $this->_sites;
00109   }

Config::setEnvironmentDir ( name_  ) 

Set the directory where the application is installed.

Ie. '/opt/RootLive/'

Returns:
string

Definition at line 53 of file Config.php.

00054   {
00055     $this->_environmentDir = rtrim($name_, '/') . '/';
00056   }


Member Data Documentation

Config::$_dbConfig [private]

Holds a DbConfig instance Config::getDbConfig()}.

With this variable getDbConfig() don't need to recreate the instance at each call.

Definition at line 169 of file Config.php.

Config::$_environmentDir [private]

See setEnvironmentDir().

Definition at line 161 of file Config.php.

Config::$_sites [private]

A list of SiteConfig objects.

Definition at line 174 of file Config.php.


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

Generated on Wed May 6 23:28:24 2009 for fareofficelib by  doxygen 1.5.8