改名
This commit is contained in:
+20
-3
@@ -11,11 +11,13 @@ namespace Kiri;
|
||||
|
||||
|
||||
use Closure;
|
||||
use Console\CommandInterface;
|
||||
use Console\Console;
|
||||
use Console\ConsoleProviders;
|
||||
use Database\DatabasesProviders;
|
||||
use Exception;
|
||||
use Http\Context\Response;
|
||||
use Http\Server;
|
||||
use Http\ServerProviders;
|
||||
use Kiri\Abstracts\BaseApplication;
|
||||
use Kiri\Abstracts\Config;
|
||||
@@ -86,6 +88,8 @@ class Application extends BaseApplication
|
||||
{
|
||||
$manager = di(ServerManager::class);
|
||||
$manager->addProcess(FileChangeCustomProcess::class);
|
||||
|
||||
putenv('enableFileChange=on');
|
||||
}
|
||||
|
||||
|
||||
@@ -161,14 +165,14 @@ class Application extends BaseApplication
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function start(Input $argv): void
|
||||
public function execute(Input $argv): void
|
||||
{
|
||||
try {
|
||||
/** @var Console $manager */
|
||||
$manager = Kiri::app()->get('console');
|
||||
$manager->register(Runtime::class);
|
||||
$class = $manager->setParameters($argv)->search();
|
||||
|
||||
$this->enableFileChange($class);
|
||||
|
||||
$data = $this->getBuilder($manager->exec($class));
|
||||
} catch (\Throwable $exception) {
|
||||
$data = $this->getBuilder(logger()->exception($exception));
|
||||
@@ -179,6 +183,19 @@ class Application extends BaseApplication
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @throws NotFindClassException
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
private function enableFileChange($class): void
|
||||
{
|
||||
$this->register(Runtime::class);
|
||||
if (env('enableFileChange', 'off') == 'off' || !($class instanceof Server)) {
|
||||
scan_directory(directory('app'), 'App');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @return Response|ResponseInterface
|
||||
|
||||
Reference in New Issue
Block a user