mirror of
https://github.com/flarum/framework.git
synced 2025-02-06 09:51:18 +08:00
parent
8faf774210
commit
ccb8b1b6cc
|
@ -60,6 +60,7 @@
|
||||||
"s9e/text-formatter": "^1.2.0",
|
"s9e/text-formatter": "^1.2.0",
|
||||||
"symfony/config": "^3.3",
|
"symfony/config": "^3.3",
|
||||||
"symfony/console": "^4.2",
|
"symfony/console": "^4.2",
|
||||||
|
"symfony/event-dispatcher": "^4.3.2",
|
||||||
"symfony/translation": "^3.3",
|
"symfony/translation": "^3.3",
|
||||||
"symfony/yaml": "^3.3",
|
"symfony/yaml": "^3.3",
|
||||||
"tobscure/json-api": "^0.3.0",
|
"tobscure/json-api": "^0.3.0",
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace Flarum\Console\Event;
|
||||||
use Flarum\Foundation\Application;
|
use Flarum\Foundation\Application;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Symfony\Component\Console\Application as ConsoleApplication;
|
use Symfony\Component\Console\Application as ConsoleApplication;
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure the console application.
|
* Configure the console application.
|
||||||
|
@ -31,15 +32,21 @@ class Configuring
|
||||||
* @var ConsoleApplication
|
* @var ConsoleApplication
|
||||||
*/
|
*/
|
||||||
public $console;
|
public $console;
|
||||||
|
/**
|
||||||
|
* @var EventDispatcher
|
||||||
|
*/
|
||||||
|
public $eventDispatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Application $app
|
* @param Application $app
|
||||||
* @param ConsoleApplication $console
|
* @param ConsoleApplication $console
|
||||||
|
* @param EventDispatcher $eventDispatcher
|
||||||
*/
|
*/
|
||||||
public function __construct(Application $app, ConsoleApplication $console)
|
public function __construct(Application $app, ConsoleApplication $console, EventDispatcher $eventDispatcher)
|
||||||
{
|
{
|
||||||
$this->app = $app;
|
$this->app = $app;
|
||||||
$this->console = $console;
|
$this->console = $console;
|
||||||
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,6 +16,7 @@ use Flarum\Foundation\Application;
|
||||||
use Flarum\Foundation\SiteInterface;
|
use Flarum\Foundation\SiteInterface;
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
use Symfony\Component\Console\Application as ConsoleApplication;
|
use Symfony\Component\Console\Application as ConsoleApplication;
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
|
|
||||||
class Server
|
class Server
|
||||||
{
|
{
|
||||||
|
@ -46,6 +47,8 @@ class Server
|
||||||
$app = Application::getInstance();
|
$app = Application::getInstance();
|
||||||
|
|
||||||
$events = $app->make(Dispatcher::class);
|
$events = $app->make(Dispatcher::class);
|
||||||
$events->fire(new Configuring($app, $console));
|
$events->fire(new Configuring($app, $console, $dispatcher = new EventDispatcher()));
|
||||||
|
|
||||||
|
$console->setDispatcher($dispatcher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user