Skip to content

Commit

Permalink
增加非调试模式下禁止wsdebug推送和展示
Browse files Browse the repository at this point in the history
  • Loading branch information
hanwenbo committed Sep 1, 2018
1 parent cae221c commit 731b1d6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
36 changes: 36 additions & 0 deletions src/WsDebug.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
*
* Copyright FaShop
* License http://www.fashop.cn
* link http://www.fashop.cn
* Created by FaShop.
* User: hanwenbo
* Date: 2018/9/1
* Time: 下午11:40
*
*/

namespace ezswoole;


class WsDebug extends \wsdebug\WsDebug
{
public function send( $message, string $type = 'info' )
{
if( config( 'app_debug' ) === true ){
parent::send( $message, $type );
} else{
return false;
}
}

public function getHtml() : string
{
if( config( 'app_debug' ) === true ){
parent::getHtml();
} else{
return 'closed';
}
}
}
2 changes: 1 addition & 1 deletion src/helper/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use ezswoole\Session;
use EasySwoole\Core\Component\Di;
use ezswoole\Response;
use wsdebug\WsDebug;
use ezswoole\WsDebug;
use EasySwoole\Core\Swoole\ServerManager;

if( !function_exists( 'load_trait' ) ){
Expand Down
2 changes: 1 addition & 1 deletion tests/v2/Conf/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private function userConf()
$config = [
'app_host' => '',
// 应用调试模式
'app_debug' => true,
'app_debug' => false,
// 入口自动绑定模块
'auto_bind_module' => false,
// 默认时区
Expand Down
4 changes: 2 additions & 2 deletions tests/v2/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"psr-4": {
"EasySwoole\\" : "Conf/",
"App\\": "App/",
"ezswoole\\": "../src/"
"ezswoole\\": "../../src/"
},
"files": ["../src/helper/helper.php"]
"files": ["../../src/helper/helper.php"]
},
"require-dev": {
"easyswoole/swoole-ide-helper": "dev-master"
Expand Down

0 comments on commit 731b1d6

Please sign in to comment.