1
0
mirror of https://github.com/flarum/core.git synced 2025-07-25 18:51:40 +02:00

Redo installer

This commit is contained in:
Franz Liedke
2015-08-12 01:41:42 +02:00
parent 2ce8b02245
commit 5d8371935e
7 changed files with 295 additions and 67 deletions

View File

@@ -0,0 +1,57 @@
<?php namespace Flarum\Console;
use Symfony\Component\Console\Command\Command as SymfonyCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
abstract class Command extends SymfonyCommand
{
/**
* @var InputInterface
*/
protected $input;
/**
* @var OutputInterface
*/
protected $output;
/**
* @inheritDoc
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->output = $output;
$this->fire();
}
/**
* Fire the command.
*
* @return void
*/
abstract protected function fire();
/**
* Did the user pass the given option?
*
* @param string $name
* @return bool
*/
protected function hasOption($name)
{
return $this->input->hasOption($name);
}
/**
* Send an info string to the user.
*
* @param string $string
*/
protected function info($string)
{
$this->output->writeln("<info>$string</info>");
}
}

View File

@@ -11,7 +11,7 @@ class ConsoleServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->commands('Flarum\Console\InstallCommand');
//$this->commands('Flarum\Console\InstallCommand');
$this->commands('Flarum\Console\SeedCommand');
$this->commands('Flarum\Console\ImportCommand');
$this->commands('Flarum\Console\GenerateExtensionCommand');

View File

@@ -1,66 +0,0 @@
<?php namespace Flarum\Console;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class InstallCommand extends Command
{
/**
* The console command name.
*
* @var string
*/
protected $name = 'install';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Run Flarum\'s installation migrations and seeds.';
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$path = str_replace($this->laravel['path.base'].'/', '', __DIR__.'/../../migrations');
$this->call('migrate', ['--path' => $path]);
$this->call('db:seed', ['--class' => 'Flarum\Core\Seeders\ConfigTableSeeder']);
$this->call('db:seed', ['--class' => 'Flarum\Core\Seeders\GroupsTableSeeder']);
$this->call('db:seed', ['--class' => 'Flarum\Core\Seeders\PermissionsTableSeeder']);
// Create config file so that we know Flarum is installed
copy(base_path('../config.example.php'), base_path('../config.php'));
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return [
// ['example', InputArgument::REQUIRED, 'An example argument.'],
];
}
/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return [
// ['example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null],
];
}
}