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. |
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
Definition at line 35 of file Config.php.
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.
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.
$configName_ | - string - The name of the database configuration. For more information see DbConfig::setDSN() |
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/'
Definition at line 64 of file Config.php.
Referenced by getLogDir(), and getSiteDir().
Config::getLogDir | ( | ) |
Returns the directory where the general log files are saved.
Ie. '/opt/RootLive/Log/'
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.
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/'
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.
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/'
Definition at line 53 of file Config.php.
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] |
Config::$_sites [private] |