diff --git a/kiri-engine/Application.php b/kiri-engine/Application.php index bb3accbf..ee6dfac3 100644 --- a/kiri-engine/Application.php +++ b/kiri-engine/Application.php @@ -238,9 +238,6 @@ class Application extends BaseApplication private function enableFileChange(Command $class, $input, $output): void { fire(new OnBeforeCommandExecute()); - if (!($class instanceof HotReload)) { - $this->fileListener(); - } $this->getContainer()->setBindings(OutputInterface::class, $output); @@ -250,20 +247,6 @@ class Application extends BaseApplication } - /** - * @return void - * @throws Exception - * @throws ReflectionException - */ - 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 diff --git a/kiri-engine/FileListen/HotReload.php b/kiri-engine/FileListen/HotReload.php index d6192579..31770b29 100644 --- a/kiri-engine/FileListen/HotReload.php +++ b/kiri-engine/FileListen/HotReload.php @@ -211,6 +211,11 @@ class HotReload extends Command $this->stopServer(); $this->process = new Process(function (Process $process) { + scan_directory(MODEL_PATH, 'app\Model'); + $config = Config::get('scanner', []); + if (is_array($config)) foreach ($config as $key => $value) { + scan_directory($value, $key); + } Kiri::app()->getServer()->start(); }); $this->process->start();