From 86a239082e393a302294e43fd322d77df6ba30cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Wed, 3 Nov 2021 16:29:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 1 - kiri-engine/Application.php | 12 +++--------- kiri-engine/Events/OnAfterCommandExecute.php | 16 ++++++++++++++++ kiri-engine/Events/OnBeforeCommandExecute.php | 8 ++++++++ 4 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 kiri-engine/Events/OnAfterCommandExecute.php create mode 100644 kiri-engine/Events/OnBeforeCommandExecute.php diff --git a/composer.json b/composer.json index 691fc690..25a8d14e 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,6 @@ "ext-sockets": "*", "ext-pcntl": "*", "ext-posix": "*", - "ext-gd": "*", "composer-runtime-api": "^2.0", "swiftmailer/swiftmailer": "^6.0", "psr/container": "^2.0", diff --git a/kiri-engine/Application.php b/kiri-engine/Application.php index ab619139..d8115d40 100644 --- a/kiri-engine/Application.php +++ b/kiri-engine/Application.php @@ -17,10 +17,11 @@ use Kiri\Abstracts\BaseApplication; use Kiri\Abstracts\Config; use Kiri\Abstracts\Kernel; use Kiri\Crontab\CrontabProviders; +use Kiri\Events\OnAfterCommandExecute; +use Kiri\Events\OnBeforeCommandExecute; use Kiri\Exception\NotFindClassException; use Kiri\FileListen\FileChangeCustomProcess; use ReflectionException; -use Server\Events\OnBeforeCommandExecute; use Server\ServerCommand; use Server\ServerProviders; use stdClass; @@ -129,7 +130,6 @@ class Application extends BaseApplication */ public function middleware(Closure|array $closure): static { - $this->getRouter()->setMiddleware($closure); return $this; } @@ -141,7 +141,6 @@ class Application extends BaseApplication */ public function setUseTree(bool $useTree): static { - $this->getRouter()->setUseTree($useTree); return $this; } @@ -230,17 +229,12 @@ class Application extends BaseApplication private function enableFileChange(Command $class, $input, $output): void { fire(new OnBeforeCommandExecute()); -// if (!($class instanceof ServerCommand)) { -// scan_directory(directory('app'), 'App'); -// } else if (!is_enable_file_modification_listening()) { -// $this->getRouter()->read_files(); -// scan_directory(directory('app'), 'App'); -// } scan_directory(directory('app'), 'App'); if ($class instanceof ServerCommand) { $this->getRouter()->read_files(); } $class->run($input, $output); + fire(new OnAfterCommandExecute()); $output->writeln('ok' . PHP_EOL); } diff --git a/kiri-engine/Events/OnAfterCommandExecute.php b/kiri-engine/Events/OnAfterCommandExecute.php new file mode 100644 index 00000000..17b322d5 --- /dev/null +++ b/kiri-engine/Events/OnAfterCommandExecute.php @@ -0,0 +1,16 @@ +