59 lines
1.6 KiB
PHP
59 lines
1.6 KiB
PHP
<?php
|
|
// --- Define path to application directory
|
|
defined('APPLICATION_PATH')
|
|
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../../application'));
|
|
|
|
// --- Define application environment
|
|
defined('APPLICATION_ENV')
|
|
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
|
|
|
// --- Composer autoload
|
|
require_once realpath(__DIR__ . '/../../vendor/autoload.php');
|
|
|
|
try {
|
|
$opts = new Zend_Console_Getopt(
|
|
//Options
|
|
array(
|
|
'help|?' => "Display usage information.",
|
|
'install=s' => "Make install operation.",
|
|
)
|
|
);
|
|
$opts->parse();
|
|
} catch (Zend_Console_Getopt_Exception $e) {
|
|
echo $e->getUsageMessage();
|
|
exit;
|
|
}
|
|
|
|
//Usage
|
|
if (isset($opts->help))
|
|
{
|
|
echo $opts->getUsageMessage();
|
|
exit;
|
|
}
|
|
|
|
|
|
if ( ! empty($opts->install) )
|
|
{
|
|
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";
|
|
}
|