delete config file configuration.ini

This commit is contained in:
Michael RICOIS 2013-01-28 17:31:29 +00:00
parent 4005d8fb67
commit d8cd599d24
11 changed files with 140 additions and 73 deletions

View File

@ -1,7 +1,14 @@
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
//Initialisation global des paramètres de vue
protected function _initConfig()
{
$config = new Zend_Config($this->getOptions());
Zend_Registry::set('config', $config);
return $config;
}
//Initialisation global des paramètres de vue
protected function _initViewSettings()
{
$this->bootstrap('view');
@ -30,9 +37,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
protected function _initDb()
{
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
$c = Zend_Registry::get('config');
try {
$db = Zend_Db::factory($dbConfig->db);
$db = Zend_Db::factory($c->profil->db);
Zend_Db_Table::setDefaultAdapter ($db);
} catch ( Exception $e ) {
exit ( $e->getMessage() );

View File

@ -12,6 +12,21 @@ resources.layout.layout = "main"
resources.layout.layoutPath = APPLICATION_PATH "/views"
resources.view.basePath = APPLICATION_PATH "/views"
; Scores configuration
profil.server.name = sdsrvdev01
profil.webservice.location = local
profil.mail.method = smtp
profil.mail.smtp_host = smtp.free.fr
profil.mail.email.support = support@scores-decisions.com
profil.mail.email.supportdev = supportdev@scores-decisions.com
profil.path.data = "C:\Users\mricois\www\dataenrichissement"
profil.db.adapter=mysqli
profil.db.params.host=127.0.0.1
profil.db.params.username=root
profil.db.params.password=bj10sx
profil.db.params.dbname=enrichissement
profil.db.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
[staging : production]
resources.frontController.params.displayExceptions = 0
phpSettings.soap.wsdl_cache_enabled = 0

View File

@ -20,8 +20,8 @@ class DoublonController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
$path = realpath($config->data).'/doublon';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->data).'/doublon';
if(!file_exists($path)) mkdir($path);
if ( isset($_FILES) && count($_FILES)==1 ){
@ -71,10 +71,10 @@ class DoublonController extends Zend_Controller_Action
$request = $this->getRequest();
$file = $request->getParam('file');
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
$c = Zend_Registry::get('config');
$pathIn = $config->data.'/doublon';
$pathOut = $config->data.'/doublon';
$pathIn = $c->profil->path->data.'/doublon';
$pathOut = $c->profil->path->data.'/doublon';
if(!file_exists($pathOut)) mkdir($pathOut);
//Vérifier le format du fichier

View File

@ -52,8 +52,8 @@ class EnvoiController extends Zend_Controller_Action
}
else
{
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
$path = realpath($config->data).'/validation';
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->data).'/validation';
if(!file_exists($path)) mkdir($path);
if ( isset($_FILES) && count($_FILES)==1 ){
@ -104,10 +104,10 @@ class EnvoiController extends Zend_Controller_Action
$request = $this->getRequest();
$file = $request->getParam('file');
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
$c = Zend_Registry::get('config');
$pathIn = $config->data.'/validation';
$pathOut = $config->data.'/clients';
$pathIn =$c->profil->path->data.'/validation';
$pathOut = $c->profil->path->data.'/clients';
if(!file_exists($pathOut)) mkdir($pathOut);
//Vérifier le format du fichier

View File

@ -43,9 +43,9 @@ if(isset($opts->help))
exit;
}
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
$db = Zend_Db::factory($dbConfig->db);
$c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db);
$commandesM = new Application_Model_Commandes($db);
$sql = $commandesM->select()
@ -55,7 +55,7 @@ $sql = $commandesM->select()
$result = $commandesM->fetchAll($sql);
if ( count($result)>0 ) {
} else {
@ -71,5 +71,5 @@ if ( count($result)>0 ) {
echo "Lancement enrichissement $info->id\n";
exec(realpath(dirname(__FILE__))."/enrichissement.php --id ".$info->id." &");
}
}

View File

@ -242,9 +242,9 @@ $cache = Zend_Cache::factory('Core','Apc', $frontendOptions, $backendOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
//Définition bdd local
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
$c = new Zend_Config($application->getOptions());
try {
$db = Zend_Db::factory($dbConfig->db);
$db = Zend_Db::factory($c->profil->db);
} catch ( Exception $e ) {
exit ( $e->getMessage() );
}
@ -259,8 +259,7 @@ if ($opts->id) {
$extension = strrchr($file,'.');
$file = str_replace($extension, '', $file);
$path = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
if (!file_exists($path->data.'/export')) mkdir($path->data.'/export');
if (!file_exists($c->profil->path->data.'/export')) mkdir($c->profil->path->data.'/export');
if ($opts->id) {
$profilM = new Application_Model_Profil($db);
@ -307,7 +306,7 @@ $tabData = array();
$posKeySiren = $posKeySiret = $posKeyNic = false;
//Fichier de définition
$inFile = $path->data.'/clients/'.$file.'.csv';
$inFile = $c->profil->path->data.'/clients/'.$file.'.csv';
//Lire le fichier csv
$row = 0;
@ -464,7 +463,7 @@ if (count($tabEntete)>0){
//Définition du fichier de sortie
if ( $opts->reprise ) {
$outFile = $path->data.'/export/'.$commande->fichierOut;
$outFile = $c->profil->path->data.'/export/'.$commande->fichierOut;
$rowReprise = 0;
$fp = fopen($outFile, 'r+');
@ -473,7 +472,7 @@ if ( $opts->reprise ) {
}
} else {
$outFile = $path->data.'/export/'.$file.'-'.date('YmdHis').'.csv';
$outFile = $c->profil->path->data.'/export/'.$file.'-'.date('YmdHis').'.csv';
//Ecriture de l'entete du fichier
$fp = fopen($outFile, 'w');

View File

@ -58,18 +58,24 @@ function writeConfig()
{
global $hostname;
//Copie de la configuration
$configDir = realpath(dirname(__FILE__)).'/config';
$appconfigDir = '../application/configs';
$hostname = exec('echo $(hostname)');
passthru('cp -fv '.
$configDir.'/'.$hostname.'/application.ini' . ' ' .
$appconfigDir.'/application.ini');
$arrayConfig = array(
'mysql.php',
'stockage.php',
'mysql.php',
'stockage.php',
);
foreach($arrayConfig as $config) {
passthru('cp -v '.
realpath(dirname(__FILE__)).'/'.$hostname.'/'.$config.' ' .
realpath(dirname(__FILE__)).'/'.$config);
}
passthru('cp -v '.
realpath(dirname(__FILE__)).'/'.$hostname.'/configuration.ini'.' '.
realpath(dirname(__FILE__)).'/../application/configs/configuration.ini');
}

View File

@ -0,0 +1,42 @@
[production]
phpSettings.date.timezone = "Europe/Paris"
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
autoloaderNamespaces[] = "Application_"
resources.layout.layout = "main"
resources.layout.layoutPath = APPLICATION_PATH "/views"
resources.view.basePath = APPLICATION_PATH "/views"
; Scores configuration
profil.server.name = local
profil.webservice.location = local
profil.mail.method = smtp
profil.mail.smtp_host = smtp.free.fr
profil.mail.email.support = support@scores-decisions.com
profil.mail.email.supportdev = supportdev@scores-decisions.com
profil.path.data = "C:\Users\mricois\www\dataenrichissement"
profil.db.adapter=mysqli
profil.db.params.host=127.0.0.1
profil.db.params.username=root
profil.db.params.password=password
profil.db.params.dbname=enrichissement
profil.db.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
[staging : production]
resources.frontController.params.displayExceptions = 0
phpSettings.soap.wsdl_cache_enabled = 0
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
phpSettings.soap.wsdl_cache_enabled = 0
resources.frontController.params.displayExceptions = 1
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

View File

@ -1,22 +0,0 @@
[server]
name = sdsrvdev01
[databases]
db.adapter=mysqli
db.params.host=127.0.0.1
db.params.username=root
db.params.password=password
db.params.dbname=enrichissement
db.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
[mail]
method = smtp
smpt_port =
smtp_host = smtp.free.fr
support = mricois@scores-decisions.com
supportdev = mricois@scores-decisions.com
contact = mricois@scores-decisions.com
production = mricois@scores-decisions.com
[path]
data = "d:\www\dataenrichissement"

View File

@ -0,0 +1,42 @@
[production]
phpSettings.date.timezone = "Europe/Paris"
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
autoloaderNamespaces[] = "Application_"
resources.layout.layout = "main"
resources.layout.layoutPath = APPLICATION_PATH "/views"
resources.view.basePath = APPLICATION_PATH "/views"
; Scores configuration
profil.server.name = sdsrvdev01
profil.webservice.location = local
profil.mail.method = smtp
profil.mail.smtp_host = smtp.free.fr
profil.mail.email.support = support@scores-decisions.com
profil.mail.email.supportdev = supportdev@scores-decisions.com
profil.path.data = "/sites/dataenrichissement"
profil.db.adapter=mysqli
profil.db.params.host=127.0.0.1
profil.db.params.username=enrichissement
profil.db.params.password=aY5EWvtMmXrqKwK8
profil.db.params.dbname=enrichissement
profil.db.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
[staging : production]
resources.frontController.params.displayExceptions = 0
phpSettings.soap.wsdl_cache_enabled = 0
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
phpSettings.soap.wsdl_cache_enabled = 0
resources.frontController.params.displayExceptions = 1
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

View File

@ -1,22 +0,0 @@
[server]
name = sdsrvdev01
[databases]
db.adapter=mysqli
db.params.host=127.0.0.1
db.params.username=enrichissement
db.params.password=aY5EWvtMmXrqKwK8
db.params.dbname=enrichissement
db.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
[mail]
method = smtp
smpt_port =
smtp_host = smtp.free.fr
support = mricois@scores-decisions.com
supportdev = mricois@scores-decisions.com
contact = mricois@scores-decisions.com
production = mricois@scores-decisions.com
[path]
data = "/sites/dataenrichissement"