From 4f54e5bdf87bdf1d70ebe48e660e44357400211d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Mon, 14 Feb 2022 18:04:47 +0800 Subject: [PATCH] modify plugin name --- function.php | 1 - kiri-engine/Application.php | 26 +++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/function.php b/function.php index cc1ca89e..013bcfae 100644 --- a/function.php +++ b/function.php @@ -17,7 +17,6 @@ use Kiri\Exception\ConfigException; use Kiri\Message\Handler\Router; use Psr\Log\LoggerInterface; use Swoole\Process; -use Swoole\WebSocket\Server; if (!function_exists('make')) { diff --git a/kiri-engine/Application.php b/kiri-engine/Application.php index 1574a8ed..cef406a3 100644 --- a/kiri-engine/Application.php +++ b/kiri-engine/Application.php @@ -229,15 +229,9 @@ class Application extends BaseApplication private function enableFileChange(Command $class, $input, $output): void { fire(new OnBeforeCommandExecute()); -// if (!($class instanceof HotReload)) { -// $config = Config::get('scanner', []); -// if (!empty($config)) { -// foreach ($config as $key => $value) { -// scan_directory($value, $key); -// } -// } -// scan_directory(MODEL_PATH, 'app\Model'); -// } + if (!($class instanceof HotReload)) { + $this->fileListener(); + } $this->getContainer()->setBindings(OutputInterface::class, $output); @@ -247,6 +241,20 @@ class Application extends BaseApplication } + /** + * @return void + * @throws Exception + */ + protected function fileListener(): void + { + $config = Config::get('scanner', []); + if (is_array($config)) foreach ($config as $key => $value) { + scan_directory($value, $key); + } + scan_directory(MODEL_PATH, 'app\Model'); + } + + /** * @param $className * @param null $abstracts