改名
This commit is contained in:
+3
-3
@@ -21,6 +21,7 @@
|
||||
"ext-xml": "*",
|
||||
"ext-curl": "*",
|
||||
"ext-openssl": "*",
|
||||
"symfony/console": "^2.4 || ^3.0 || ^4.0",
|
||||
"amphp/amp": "v1.2.2",
|
||||
"psr/log": "1.*",
|
||||
"ext-sockets": "*",
|
||||
@@ -34,7 +35,8 @@
|
||||
"psr/cache": "^3.0",
|
||||
"psr/http-client": "^1.0",
|
||||
"psr/simple-cache": "^1.0",
|
||||
"game-worker/kiri-event": "v1.0"
|
||||
"game-worker/kiri-event": "v1.0",
|
||||
"linkorb/etcd-php": "^1.6"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -49,7 +51,5 @@
|
||||
"error.php",
|
||||
"function.php"
|
||||
]
|
||||
},
|
||||
"require-dev": {
|
||||
}
|
||||
}
|
||||
|
||||
+23
-10
@@ -17,11 +17,9 @@ use Database\DatabasesProviders;
|
||||
use Exception;
|
||||
use Http\Command;
|
||||
use Http\Context\Response;
|
||||
use Http\Server;
|
||||
use Http\ServerProviders;
|
||||
use Kiri\Abstracts\BaseApplication;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Abstracts\Input;
|
||||
use Kiri\Abstracts\Kernel;
|
||||
use Kiri\Crontab\CrontabProviders;
|
||||
use Kiri\Exception\NotFindClassException;
|
||||
@@ -31,6 +29,8 @@ use Server\ResponseInterface;
|
||||
use stdClass;
|
||||
use Swoole\Process;
|
||||
use Swoole\Timer;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
/**
|
||||
* Class Init
|
||||
@@ -191,27 +191,40 @@ class Application extends BaseApplication
|
||||
public function register(string $command)
|
||||
{
|
||||
/** @var Console $abstracts */
|
||||
$abstracts = $this->get('console');
|
||||
$abstracts->register($command);
|
||||
// $abstracts = $this->get('console');
|
||||
// $abstracts->register($command);
|
||||
|
||||
$console = di(\Symfony\Component\Console\Application::class);
|
||||
$console->add(di($command));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Input $argv
|
||||
* @param array $argv
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function execute(Input $argv): void
|
||||
public function execute(array $argv): void
|
||||
{
|
||||
try {
|
||||
$this->register(Runtime::class);
|
||||
|
||||
$manager = Kiri::app()->get('console');
|
||||
$class = $manager->setParameters($argv)->search();
|
||||
$input = new ArgvInput($argv);
|
||||
|
||||
$this->enableFileChange($class);
|
||||
$console = di(\Symfony\Component\Console\Application::class);
|
||||
$command = $console->find($input->getFirstArgument());
|
||||
|
||||
$data = $this->getBuilder($manager->exec($class));
|
||||
// /** @var Console $manager */
|
||||
// $manager = Kiri::app()->get('console');
|
||||
// $class = $manager->setParameters($argv)->search();
|
||||
|
||||
$command->run($input, $output = new ConsoleOutput());
|
||||
|
||||
$this->enableFileChange($command);
|
||||
|
||||
$data = $output->getStream();
|
||||
|
||||
// $data = $this->getBuilder($manager->exec($class));
|
||||
} catch (\Throwable $exception) {
|
||||
$data = $this->getBuilder(jTraceEx($exception));
|
||||
} finally {
|
||||
|
||||
+18
-6
@@ -9,17 +9,19 @@ use Exception;
|
||||
use Kiri\Abstracts\Input;
|
||||
use Kiri\Events\EventProvider;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Exception\NotFindClassException;
|
||||
use Kiri\Kiri;
|
||||
use ReflectionException;
|
||||
use Server\Events\OnBeforeWorkerStart;
|
||||
use Server\Events\OnWorkerStart;
|
||||
use Server\Worker\OnServerWorker;
|
||||
use Server\Worker\OnWorkerStart as WorkerDispatch;
|
||||
use Server\Events\OnWorkerStart;
|
||||
|
||||
/**
|
||||
* Class Command
|
||||
* @package Http
|
||||
*/
|
||||
class Command extends \Console\Command
|
||||
class Command extends \Symfony\Component\Console\Command\Command
|
||||
{
|
||||
|
||||
public string $command = 'sw:server';
|
||||
@@ -32,12 +34,22 @@ class Command extends \Console\Command
|
||||
|
||||
|
||||
/**
|
||||
* @var \Kiri\Events\EventProvider
|
||||
* @var EventProvider
|
||||
*/
|
||||
#[Inject(EventProvider::class)]
|
||||
public EventProvider $eventProvider;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('swoole')
|
||||
->setDescription('server start|stop|reload|restart');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Input $dtl
|
||||
* @return string
|
||||
@@ -65,10 +77,10 @@ class Command extends \Console\Command
|
||||
/**
|
||||
* @param $manager
|
||||
* @return mixed
|
||||
* @throws \Kiri\Exception\NotFindClassException
|
||||
* @throws \ReflectionException
|
||||
* @throws NotFindClassException
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
private function generate_runtime_builder($manager)
|
||||
private function generate_runtime_builder($manager): mixed
|
||||
{
|
||||
exec(PHP_BINARY . ' ' . APP_PATH . 'kiri.php runtime:builder');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user