This commit is contained in:
2021-11-19 14:46:07 +08:00
parent 065555a80e
commit 39394f76d5
2 changed files with 15 additions and 4 deletions
+8
View File
@@ -0,0 +1,8 @@
<?php
namespace Server\Events;
class OnServerBeforeStart
{
}
+7 -4
View File
@@ -7,9 +7,10 @@ namespace Server;
use Annotation\Inject; use Annotation\Inject;
use Exception; use Exception;
use Kiri\Abstracts\Config; use Kiri\Abstracts\Config;
use Kiri\Events\EventProvider; use Kiri\Events\EventDispatch;
use Kiri\Exception\ConfigException; use Kiri\Exception\ConfigException;
use Kiri\Kiri; use Kiri\Kiri;
use Server\Events\OnServerBeforeStart;
use Swoole\Coroutine; use Swoole\Coroutine;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
@@ -29,10 +30,10 @@ class ServerCommand extends Command
/** /**
* @var EventProvider * @var EventDispatch
*/ */
#[Inject(EventProvider::class)] #[Inject(EventDispatch::class)]
public EventProvider $eventProvider; public EventDispatch $eventProvider;
/** /**
@@ -105,6 +106,8 @@ class ServerCommand extends Command
Kiri::app()->getRouter()->read_files(); Kiri::app()->getRouter()->read_files();
$this->eventProvider->dispatch(new OnServerBeforeStart());
$manager->start(); $manager->start();
return 1; return 1;