From bd96303de462eaf64ea4d10b5c931142d3b70672 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Wed, 17 Dec 2014 10:28:01 +0000 Subject: [PATCH] Utilisation de profil pour la configuration --- scripts/build/configure.php | 51 ++++++++----------- scripts/build/etc/cron.d/fluxrecv | 3 ++ .../prod-celeste}/application.ini | 0 3 files changed, 25 insertions(+), 29 deletions(-) create mode 100644 scripts/build/etc/cron.d/fluxrecv rename scripts/build/{Ftp => profil/prod-celeste}/application.ini (100%) diff --git a/scripts/build/configure.php b/scripts/build/configure.php index bef9d61..3001bed 100644 --- a/scripts/build/configure.php +++ b/scripts/build/configure.php @@ -13,36 +13,12 @@ set_include_path(implode(PATH_SEPARATOR, array( get_include_path(), ))); -//Copy configuration -$configDir = realpath(dirname(__FILE__)); -$appconfigDir = APPLICATION_PATH.'/configs'; - -if (stristr(PHP_OS, 'WIN')) { - $hostname = 'development'; -} else { - $hostname = exec('echo $(hostname)'); -} - -if ( !copy($configDir.'/'.$hostname.'/application.ini', $appconfigDir.'/application.ini') ) { - echo "application.ini could not be copied !\n"; - exit; -} - -/** Zend_Application */ -require_once 'Zend/Application.php'; - -// Create application, bootstrap, and run -$application = new Zend_Application( - APPLICATION_ENV, - APPLICATION_PATH . '/configs/application.ini' -); - try { $opts = new Zend_Console_Getopt( //Options array( 'help|?' => "Display usage information.", - 'install' => "Make install operation.", + 'install=s' => "Make install operation.", ) ); $opts->parse(); @@ -52,17 +28,34 @@ try { } //Usage -if(isset($opts->help)) +if (isset($opts->help)) { echo $opts->getUsageMessage(); exit; } -if(isset($opts->install)) + +if ( ! empty($opts->install) ) { - if (stristr(PHP_OS, 'WIN')) { + echo date('Y-m-d H:i:s')." - Démarrage de la configuration.\n"; + //Copy configuration + $configDir = realpath(dirname(__FILE__)).'/profil'; + $appconfigDir = APPLICATION_PATH.'/configs'; + $profil = $opts->install; + + if ( !file_exists( $appconfigDir.'/application.ini') ) { + $result = copy($configDir.'/'.$profil.'/application.ini', $appconfigDir.'/application.ini'); + if ($result !== true) { + 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); } + + echo date('Y-m-d H:i:s')." - Fin de la configuration.\n"; +} else { + echo date('Y-m-d H:i:s')." - Je n'ai rien fait !\n"; } diff --git a/scripts/build/etc/cron.d/fluxrecv b/scripts/build/etc/cron.d/fluxrecv new file mode 100644 index 0000000..0284e2f --- /dev/null +++ b/scripts/build/etc/cron.d/fluxrecv @@ -0,0 +1,3 @@ +# Gestion des flux a envoyer au client + +*/10 4-12 * * * root php /home/batchFlux/fileRecv.php --cron \ No newline at end of file diff --git a/scripts/build/Ftp/application.ini b/scripts/build/profil/prod-celeste/application.ini similarity index 100% rename from scripts/build/Ftp/application.ini rename to scripts/build/profil/prod-celeste/application.ini