改名
This commit is contained in:
@@ -36,8 +36,9 @@ class OnWorkerStart extends Callback
|
|||||||
putenv('state=start');
|
putenv('state=start');
|
||||||
putenv('worker=' . $worker_id);
|
putenv('worker=' . $worker_id);
|
||||||
|
|
||||||
if (env('debug') === 'true') {
|
if (env('debug', 'false') == 'true') {
|
||||||
annotation()->read(APP_PATH . 'app', 'App');
|
$attribute = Snowflake::app()->getAttributes();
|
||||||
|
$attribute->read(directory('app'), 'App');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($worker_id >= $server->setting['worker_num']) {
|
if ($worker_id >= $server->setting['worker_num']) {
|
||||||
|
|||||||
@@ -464,7 +464,7 @@ class Server extends HttpService
|
|||||||
$event = Snowflake::app()->getEvent();
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->on(Event::SERVER_WORKER_START, function () {
|
$event->on(Event::SERVER_WORKER_START, function () {
|
||||||
$annotation = Snowflake::app()->getAttributes();
|
$annotation = Snowflake::app()->getAttributes();
|
||||||
if (env('debug') !== 'true') {
|
if (env('debug') != 'true') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$router = Snowflake::app()->getRouter();
|
$router = Snowflake::app()->getRouter();
|
||||||
@@ -484,7 +484,7 @@ class Server extends HttpService
|
|||||||
$event = Snowflake::app()->getEvent();
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->on(Event::SERVER_WORKER_START, function () {
|
$event->on(Event::SERVER_WORKER_START, function () {
|
||||||
$annotation = Snowflake::app()->getAttributes();
|
$annotation = Snowflake::app()->getAttributes();
|
||||||
if (env('debug') !== 'true') {
|
if (env('debug') != 'true') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$annotation->instanceDirectoryFiles(SOCKET_PATH);
|
$annotation->instanceDirectoryFiles(SOCKET_PATH);
|
||||||
|
|||||||
@@ -109,9 +109,9 @@ class Application extends BaseApplication
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
fire(Event::SERVER_BEFORE_START);
|
fire(Event::SERVER_BEFORE_START);
|
||||||
if (env('debug') === 'false') {
|
if (env('debug') == 'false') {
|
||||||
$annotation = Snowflake::app()->getAttributes();
|
$annotation = Snowflake::app()->getAttributes();
|
||||||
$annotation->read(APP_PATH . 'app', 'App');
|
$annotation->read(directory('app'), 'App');
|
||||||
}
|
}
|
||||||
$manager = Snowflake::app()->get('console');
|
$manager = Snowflake::app()->get('console');
|
||||||
$manager->setParameters($argv);
|
$manager->setParameters($argv);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class ServerInotify extends Process
|
|||||||
public function onHandler(\Swoole\Process $process): void
|
public function onHandler(\Swoole\Process $process): void
|
||||||
{
|
{
|
||||||
set_error_handler([$this, 'onErrorHandler']);
|
set_error_handler([$this, 'onErrorHandler']);
|
||||||
if (env('debug') !== 'true') {
|
if (env('debug') != 'true') {
|
||||||
Timer::tick(100000, function () {
|
Timer::tick(100000, function () {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use HttpServer\Http\HttpParams;
|
|||||||
use HttpServer\Http\Request;
|
use HttpServer\Http\Request;
|
||||||
use HttpServer\Http\Response;
|
use HttpServer\Http\Response;
|
||||||
use HttpServer\Route\Router;
|
use HttpServer\Route\Router;
|
||||||
|
use JetBrains\PhpStorm\Pure;
|
||||||
use Snowflake\Error\Logger;
|
use Snowflake\Error\Logger;
|
||||||
use Snowflake\Exception\ComponentException;
|
use Snowflake\Exception\ComponentException;
|
||||||
use Snowflake\Exception\NotFindClassException;
|
use Snowflake\Exception\NotFindClassException;
|
||||||
@@ -119,6 +120,21 @@ if (!function_exists('recursive_directory')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!function_exists('directory')) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
#[Pure] function directory($name): string
|
||||||
|
{
|
||||||
|
return realpath(APP_PATH . $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!function_exists('isUrl')) {
|
if (!function_exists('isUrl')) {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user