mirror of
https://github.com/flarum/core.git
synced 2025-07-30 13:10:24 +02:00
Boot Flarum app in Server classes
This is in preparation for fixing #1421 - it allows us to encapsulate the exception handling in the server classes, so that we can keep the skeleton (flarum/flarum) lean.
This commit is contained in:
@@ -13,23 +13,26 @@ namespace Flarum\Console;
|
||||
|
||||
use Flarum\Console\Event\Configuring;
|
||||
use Flarum\Foundation\Application;
|
||||
use Flarum\Foundation\SiteInterface;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Symfony\Component\Console\Application as ConsoleApplication;
|
||||
|
||||
class Server
|
||||
{
|
||||
protected $commands;
|
||||
private $site;
|
||||
|
||||
public function __construct(array $commands)
|
||||
public function __construct(SiteInterface $site)
|
||||
{
|
||||
$this->commands = $commands;
|
||||
$this->site = $site;
|
||||
}
|
||||
|
||||
public function listen()
|
||||
{
|
||||
$app = $this->site->bootApp();
|
||||
|
||||
$console = new ConsoleApplication('Flarum', Application::VERSION);
|
||||
|
||||
foreach ($this->commands as $command) {
|
||||
foreach ($app->getConsoleCommands() as $command) {
|
||||
$console->add($command);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user