示例#1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln(array('', 'Welcome to Thelia install process', 'You need information about your database configuration (host, username, password, database name, etc)', '', '<info>Caution : You are installing Thelia in cli mode, we verify some information, but this information are only available for the cli php sapi</info>', '<info>This informations can be different in your apache or cgi php.ini files</info>', ''));
     $this->checkPermission($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);
     }
     $database = new Database($connection);
     $database->createDatabase($connectionInfo["dbName"]);
     $output->writeln(array("", "<info>Creating Thelia database, please wait</info>", ""));
     $database->insertSql($connectionInfo["dbName"]);
     $output->writeln(array("", "<info>Database created without errors</info>", "<info>Creating file configuration, please wait</info>", ""));
     $this->createConfigFile($connectionInfo);
     $output->writeln(array("", "<info>Config file created with success. Your thelia is installed</info>", ""));
 }