1
0
mirror of https://github.com/flarum/core.git synced 2025-10-10 22:44:25 +02:00

Implement web installer

This commit is contained in:
Toby Zerner
2015-08-17 14:12:02 +09:30
parent 17dbeefabe
commit 1052aa55ea
10 changed files with 596 additions and 45 deletions

View File

@@ -59,13 +59,20 @@ class InstallCommand extends Command
protected function init()
{
if ($this->input->getOption('defaults')) {
$this->dataSource = new DefaultData();
} else {
$this->dataSource = new DataFromUser($this->input, $this->output, $this->getHelperSet()->get('question'));
if ($this->dataSource === null) {
if ($this->input->getOption('defaults')) {
$this->dataSource = new DefaultData();
} else {
$this->dataSource = new DataFromUser($this->input, $this->output, $this->getHelperSet()->get('question'));
}
}
}
public function setDataSource(ProvidesData $dataSource)
{
$this->dataSource = $dataSource;
}
protected function install()
{
$this->storeConfiguration();
@@ -85,6 +92,7 @@ class InstallCommand extends Command
$this->createAdminUser();
$this->enableBundledExtensions();
}
protected function storeConfiguration()
@@ -106,9 +114,13 @@ class InstallCommand extends Command
],
];
$this->info('Writing config');
$this->info('Testing config');
$this->container->instance('flarum.config', $config);
$this->container->make('flarum.db');
$this->info('Writing config');
file_put_contents(
base_path('../config.php'),
'<?php return '.var_export($config, true).';'
@@ -208,6 +220,23 @@ class InstallCommand extends Command
$user->groups()->sync([1]);
}
protected function enableBundledExtensions()
{
$extensions = $this->container->make('Flarum\Support\ExtensionManager');
$migrator = $extensions->getMigrator();
foreach ($extensions->getInfo() as $extension) {
$this->info('Enabling extension: '.$extension->name);
$extensions->enable($extension->name);
foreach ($migrator->getNotes() as $note) {
$this->info($note);
}
}
}
/**
* @return \Illuminate\Database\ConnectionInterface
*/