Commit 26d04f74 authored by tufengqi's avatar tufengqi

remove or

parent 107e252a
...@@ -21,9 +21,9 @@ class YiiWeb ...@@ -21,9 +21,9 @@ class YiiWeb
{ {
public $config = []; public $config = [];
public $debug = true; public $debug = true;
public $env = 'prod'; public $env = 'prod';
private $enable = true; private $enable = true;
...@@ -34,30 +34,30 @@ class YiiWeb ...@@ -34,30 +34,30 @@ class YiiWeb
public function onWorkerStart(Server $server, int $workerId, bool $isWorker) public function onWorkerStart(Server $server, int $workerId, bool $isWorker)
{ {
if(!$isWorker){ if (!$isWorker) {
$this->enable = false; $this->enable = false;
return false; return false;
} }
if(!$server instanceof HttpServer){ if (!$server instanceof HttpServer) {
$this->enable = false; $this->enable = false;
return false; return false;
} }
$config = App::getProperties(); $config = App::getProperties();
if(!empty($config['yiiConfig'])){ if (!empty($config['yiiConfig'])) {
$yiiConfig = $config['yiiConfig']; $yiiConfig = $config['yiiConfig'];
$this->config = $yiiConfig['config']; $this->config = $yiiConfig['config'];
$this->debug = $yiiConfig['debug']; $this->debug = $yiiConfig['debug'];
$this->env = $yiiConfig['env']; $this->env = $yiiConfig['env'];
}else{ } else {
$this->enable = false; $this->enable = false;
return false; return false;
} }
defined('YII_DEBUG') or define('YII_DEBUG', $this->debug); defined('YII_DEBUG') || define('YII_DEBUG', $this->debug);
defined('YII_ENV') or define('YII_ENV', $this->env); defined('YII_ENV') || define('YII_ENV', $this->env);
defined('YII_ENABLE_ERROR_HANDLER') or define('YII_ENABLE_ERROR_HANDLER', $this->env); //必须关闭 Yii 的错误处理器 defined('YII_ENABLE_ERROR_HANDLER') || define('YII_ENABLE_ERROR_HANDLER', $this->env); //必须关闭 Yii 的错误处理器
$path = App::getAlias('@vendor/foge/swoole-yii2/Yii.php'); $path = App::getAlias('@vendor/foge/swoole-yii2/Yii.php');
require_once($path); require_once($path);
\Yii::$container = new NullContainer(); \Yii::$container = new NullContainer();
...@@ -72,7 +72,7 @@ class YiiWeb ...@@ -72,7 +72,7 @@ class YiiWeb
public function beforeRequest() public function beforeRequest()
{ {
if(!$this->enable){ if (!$this->enable) {
return false; return false;
} }
...@@ -93,7 +93,7 @@ class YiiWeb ...@@ -93,7 +93,7 @@ class YiiWeb
public function afterRequest() public function afterRequest()
{ {
if(!$this->enable){ if (!$this->enable) {
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment