mirror of
https://github.com/flarum/core.git
synced 2025-07-25 18:51:40 +02:00
Redo installer
This commit is contained in:
57
framework/core/src/Console/Command.php
Normal file
57
framework/core/src/Console/Command.php
Normal 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>");
|
||||
}
|
||||
}
|
@@ -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');
|
||||
|
@@ -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],
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user