Utilisation de profil pour la configuration
This commit is contained in:
parent
b525a49f5b
commit
bd96303de4
@ -13,36 +13,12 @@ set_include_path(implode(PATH_SEPARATOR, array(
|
|||||||
get_include_path(),
|
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 {
|
try {
|
||||||
$opts = new Zend_Console_Getopt(
|
$opts = new Zend_Console_Getopt(
|
||||||
//Options
|
//Options
|
||||||
array(
|
array(
|
||||||
'help|?' => "Display usage information.",
|
'help|?' => "Display usage information.",
|
||||||
'install' => "Make install operation.",
|
'install=s' => "Make install operation.",
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$opts->parse();
|
$opts->parse();
|
||||||
@ -52,17 +28,34 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Usage
|
//Usage
|
||||||
if(isset($opts->help))
|
if (isset($opts->help))
|
||||||
{
|
{
|
||||||
echo $opts->getUsageMessage();
|
echo $opts->getUsageMessage();
|
||||||
exit;
|
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 {
|
} 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";
|
||||||
}
|
}
|
||||||
|
3
scripts/build/etc/cron.d/fluxrecv
Normal file
3
scripts/build/etc/cron.d/fluxrecv
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Gestion des flux a envoyer au client
|
||||||
|
|
||||||
|
*/10 4-12 * * * root php /home/batchFlux/fileRecv.php --cron
|
Loading…
Reference in New Issue
Block a user