Always config

This commit is contained in:
Michael RICOIS 2015-03-27 12:42:57 +00:00
parent 711efe226c
commit a738f80c86

View File

@ -52,7 +52,7 @@ try {
exit; exit;
} }
//Usage // --- Usage
if (isset($opts->help)) if (isset($opts->help))
{ {
echo $opts->getUsageMessage(); echo $opts->getUsageMessage();
@ -64,30 +64,26 @@ if ($opts->install)
{ {
echo date('Y-m-d H:i:s')." - Démarrage de la configuration.\n"; echo date('Y-m-d H:i:s')." - Démarrage de la configuration.\n";
//Copy configuration // --- Configuration
$configDir = realpath(dirname(__FILE__)).'/profil'; $configDir = realpath(dirname(__FILE__)).'/profil';
$appconfigDir = APPLICATION_PATH.'/configs'; $appconfigDir = APPLICATION_PATH.'/configs';
$profil = $opts->install; $profil = $opts->install;
if ( ! file_exists($appconfigDir.'/application.ini') ) { // --- Copy configuration file always
$result = copy($configDir.'/'.$profil.'/application.ini', $appconfigDir.'/application.ini'); $result = copy($configDir.'/'.$profil.'/application.ini', $appconfigDir.'/application.ini');
if ($result !== true) { if ($result !== true) {
echo date('Y-m-d H:i:s')." - Impossible de copier la configuration.\n"; echo date('Y-m-d H:i:s')." - Impossible de copier la configuration.\n";
exit(1);
}
} else {
echo date('Y-m-d H:i:s')." - Le profil de configuration existe déja.\n";
exit(1); exit(1);
} }
// Create application, bootstrap, and run // --- Create application, bootstrap, and run
$application = new Zend_Application( $application = new Zend_Application(
APPLICATION_ENV, APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini' APPLICATION_PATH . '/configs/application.ini'
); );
$c = new Zend_Config($application->getOptions()); $c = new Zend_Config($application->getOptions());
//Create data directory and all his children // --- Create data directory and all his children
$dirToCreate = array( $dirToCreate = array(
APPLICATION_PATH.'/../data', APPLICATION_PATH.'/../data',
APPLICATION_PATH.'/../data/sessions', APPLICATION_PATH.'/../data/sessions',
@ -99,7 +95,7 @@ if ($opts->install)
} }
if ( substr(strtoupper(PHP_OS),0,3) != 'WIN' ) { if ( substr(strtoupper(PHP_OS),0,3) != 'WIN' ) {
//Modification des permissions // --- Modification des permissions
passthru('chown -R www-data: '.APPLICATION_PATH.'/../'); passthru('chown -R www-data: '.APPLICATION_PATH.'/../');
} }