complete install command and fix travis file
This commit is contained in:
@@ -4,5 +4,10 @@ php:
|
||||
- "5.4"
|
||||
- "5.5"
|
||||
|
||||
env:
|
||||
- DB_USER=root
|
||||
|
||||
before_script:
|
||||
- composer install
|
||||
- sh -c "mysql -u$DB_USER -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS thelia;SET FOREIGN_KEY_CHECKS = 1;'; fi"
|
||||
- php Thelia thelia:install --db_host=localhost --db_username=$DB_USER --db_name=thelia
|
||||
|
||||
@@ -41,6 +41,30 @@ class Install extends ContainerAwareCommand
|
||||
->setName("thelia:install")
|
||||
->setDescription("Install thelia using cli tools. For now Thelia only use mysql database")
|
||||
->setHelp("The <info>thelia:install</info> command install Thelia database and create config file needed.")
|
||||
->addOption(
|
||||
"db_host",
|
||||
null,
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
"host for your database"
|
||||
)
|
||||
->addOption(
|
||||
"db_username",
|
||||
null,
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
"username for your database"
|
||||
)
|
||||
->addOption(
|
||||
"db_password",
|
||||
null,
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
"password for your database"
|
||||
)
|
||||
->addOption(
|
||||
"db_name",
|
||||
null,
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
"database name"
|
||||
)
|
||||
;
|
||||
|
||||
}
|
||||
@@ -56,9 +80,19 @@ class Install extends ContainerAwareCommand
|
||||
|
||||
$this->checkPermission($output);
|
||||
|
||||
do {
|
||||
$connectionInfo = $this->getConnectionInfo($input, $output);
|
||||
} while(false === $connection = $this->tryConnection($connectionInfo, $output));
|
||||
|
||||
$connectionInfo = array(
|
||||
"host" => $input->getOption("db_host"),
|
||||
"dbName" => $input->getOption("db_name"),
|
||||
"username" => $input->getOption("db_username"),
|
||||
"password" => $input->getOption("db_password")
|
||||
);
|
||||
|
||||
|
||||
|
||||
while(false === $connection = $this->tryConnection($connectionInfo, $output)) {
|
||||
$connectionInfo = $this->getConnectionInfo($input, $output);
|
||||
}
|
||||
|
||||
$this->createDatabase($connection, $connectionInfo["dbName"]);
|
||||
|
||||
|
||||
0
local/config/database.yml.sample
Executable file → Normal file
0
local/config/database.yml.sample
Executable file → Normal file
Reference in New Issue
Block a user