protected function execute(InputInterface $input, OutputInterface $output)
{
if (!in_array($this->option('db-driver'), ['mysql', 'sqlite'])) {
$this->error("Unsupported db driver.");
exit;
}
$this->line("Setting up Pagekit installation...");
$app = $this->container;
App::module('session')->config['storage'] = 'array';
$app->boot();
$app['module']->load('installer');
$installer = new Installer($app);
$dbDriver = $this->option('db-driver');
$config = ['locale' => $this->option('locale'), 'database' => ['default' => $dbDriver, 'connections' => [$dbDriver => ['dbname' => $this->option('db-name'), 'host' => $this->option('db-host'), 'user' => $this->option('db-user'), 'password' => $this->option('db-pass'), 'prefix' => $this->option('db-prefix')]]]];
$user = ['username' => $this->option('username'), 'password' => $this->option('password'), 'email' => $this->option('mail')];
$options = ['system' => ['site' => ['locale' => $this->option('locale')], 'admin' => ['locale' => $this->option('locale')]], 'system/site' => ['title' => $this->option('title')]];
$result = $installer->install($config, $options, $user);
$status = $result['status'];
$message = $result['message'];
if ($status == 'success') {
$this->line("Done");
} else {
$this->error($message);
}
}