batch/scripts/build/configure.php

65 lines
1.5 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');
//Copy configuration
$configDir = realpath(dirname(__FILE__)).'/config';
$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;
}
if ( !copy($configDir.'/'.$hostname.'/config.php', $appconfigDir.'/config.php') ) {
echo "config.php could not be copied !\n";
exit;
}
// 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.",
)
);
$opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage();
exit;
}
//Usage
if(isset($opts->help))
{
echo $opts->getUsageMessage();
exit;
}
if(isset($opts->install))
{
if (stristr(PHP_OS, 'WIN')) {
} else {
}
}