starlinks/library/Scores/Configure.php
Michael RICOIS bdce1b423e Demarrage
2015-09-29 10:09:23 +00:00

102 lines
3.4 KiB
PHP

<?php
class Configure
{
/**
* Configuration object
* @var Zend_Config_Ini
*/
protected $profil;
public function __construct()
{
$this->readConfig();
$this->_defineDb();
$this->_definePath();
$this->_defineSphinx();
$this->_defineMail();
}
/**
* Read config application.ini
*/
protected function readConfig()
{
if ( Zend_Registry::isRegistered('config') ) {
$c = Zend_Registry::get('config');
$this->profil = $c->profil;
} else {
$c = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', 'production');
$this->profil = $c->profil;
}
}
protected function _defineDb()
{
$c = Zend_Registry::get('config');
if ( $c->resources->db ) {
define('MYSQL_HOST', $c->resources->db->params->host);
define('MYSQL_USER', $c->resources->db->params->username);
define('MYSQL_PASS', $c->resources->db->params->password);
define('MYSQL_DEFAULT_DB', 'jo');
define('MYSQL_SQL_LOG', 'NONE');
}
}
protected function _definePath()
{
//Use of realpath
define('BODACC_LOCAL_DIR' , '/home/data/bodacc/');
define('JAL_LOCAL_DIR' , '/home/data/jal/');
define('HUGIN_LOCAL_DIR' , '/home/data/infosreg/hugin/');
define('ACTUSNEWS_LOCAL_DIR' , '/home/data/infosreg/actusnews/');
define('DIRELEASE_LOCAL_DIR' , '/home/data/infosreg/direlease/');
define('LESECHOS_LOCAL_DIR' , '/home/data/infosreg/lesechos/');
define('BUSINESSWIRE_LOCAL_DIR_INCOMING' , '/home/data/ftp/businesswire/');
define('BUSINESSWIRE_LOCAL_DIR' , '/home/data/infosreg/businesswire/');
define('SECURE_STORAGE' , $this->profil->path->secure.'/');
define('DOC_WEB_LOCAL' , $this->profil->path->files.'/');
define('DOC_WEB_URL' , '/fichier/');
define('LOG_PATH' , $this->profil->path->data.'/log');
}
protected function _defineSphinx()
{
// Entreprise
define('SPHINX_ENT_HOST', $this->profil->sphinx->ent->host);
define('SPHINX_ENT_PORT', intval($this->profil->sphinx->ent->port));
define('SPHINX_ENT_VERSION', $this->profil->sphinx->ent->version);
// Dirigeants
define('SPHINX_DIR_HOST', $this->profil->sphinx->dir->host);
define('SPHINX_DIR_PORT', intval($this->profil->sphinx->dir->port));
define('SPHINX_DIR_VERSION', $this->profil->sphinx->dir->version);
// Historique
define('SPHINX_HISTO_HOST', $this->profil->sphinx->histo->host);
define('SPHINX_HISTO_PORT', intval($this->profil->sphinx->histo->port));
define('SPHINX_HISTO_VERSION', $this->profil->sphinx->histo->version);
// Actionnaire
define('SPHINX_ACT_HOST', $this->profil->sphinx->act->host);
define('SPHINX_ACT_PORT', intval($this->profil->sphinx->act->port));
define('SPHINX_ACT_VERSION', $this->profil->sphinx->act->version);
//Old
define('SPHINX_HOST', $this->profil->sphinx->ent->host);
define('SPHINX_PORT', intval($this->profil->sphinx->ent->port));
}
protected function _defineMail()
{
//Messagerie
define('SMTP_HOST', $this->profil->mail->smtp_host);
define('SMTP_PORT', '');
define('SMTP_USER', '');
define('SMTP_PASS', '');
}
}