2021-08-29 01:18:42 +08:00
|
|
|
<?php
|
|
|
|
|
|
2021-09-21 02:46:21 +08:00
|
|
|
namespace Server\Abstracts;
|
2021-08-29 01:18:42 +08:00
|
|
|
|
|
|
|
|
use Annotation\Annotation;
|
2021-08-29 04:44:33 +08:00
|
|
|
use Annotation\Inject;
|
2021-08-29 01:18:42 +08:00
|
|
|
use Exception;
|
2021-09-18 16:54:39 +08:00
|
|
|
use Http\Handler\Router;
|
2021-08-29 01:18:42 +08:00
|
|
|
use Kiri\Abstracts\Config;
|
2021-09-04 00:11:53 +08:00
|
|
|
use Kiri\Di\NoteManager;
|
2021-08-29 01:18:42 +08:00
|
|
|
use Kiri\Exception\ConfigException;
|
|
|
|
|
use Kiri\Kiri;
|
|
|
|
|
use Psr\EventDispatcher\EventDispatcherInterface;
|
|
|
|
|
use ReflectionException;
|
2021-09-04 00:08:34 +08:00
|
|
|
use Server\ServerManager;
|
2021-08-29 01:18:42 +08:00
|
|
|
|
2021-09-19 16:42:29 +08:00
|
|
|
class OnWorkerStart extends WorkerStart implements EventDispatcherInterface
|
2021-08-29 01:18:42 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
2021-09-19 16:42:29 +08:00
|
|
|
/**
|
|
|
|
|
* @param object $event
|
|
|
|
|
* @return void
|
|
|
|
|
* @throws ConfigException
|
|
|
|
|
* @throws ReflectionException
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
public function dispatch(object $event)
|
|
|
|
|
{
|
|
|
|
|
$time = microtime(true);
|
|
|
|
|
|
|
|
|
|
ServerManager::setEnv('environmental', Kiri::WORKER);
|
2021-09-20 01:28:47 +08:00
|
|
|
if (is_enable_file_modification_listening()) {
|
2021-09-19 16:42:29 +08:00
|
|
|
$this->router->read_files();
|
|
|
|
|
$this->interpretDirectory();
|
|
|
|
|
}
|
2021-09-20 00:52:44 +08:00
|
|
|
$this->mixed($event, true, $time);
|
2021-09-19 16:42:29 +08:00
|
|
|
}
|
2021-08-29 01:18:42 +08:00
|
|
|
|
|
|
|
|
}
|