fixed debugbar not installed
This commit is contained in:
parent
2053e6add7
commit
c1670c6442
|
|
@ -610,6 +610,16 @@ function create_directories($directoryPath)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否安装 debugbar
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function has_debugbar(): bool
|
||||
{
|
||||
return class_exists(\Barryvdh\Debugbar\Facades\Debugbar::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP 代码 hook filter 埋点
|
||||
*
|
||||
|
|
@ -619,7 +629,7 @@ function create_directories($directoryPath)
|
|||
*/
|
||||
function hook_filter($hookKey, $hookValue): mixed
|
||||
{
|
||||
if (config('app.debug')) {
|
||||
if (config('app.debug') && has_debugbar()) {
|
||||
Debugbar::log('HOOK === hook_filter: ' . $hookKey);
|
||||
}
|
||||
|
||||
|
|
@ -634,7 +644,7 @@ function hook_filter($hookKey, $hookValue): mixed
|
|||
*/
|
||||
function hook_action($hookKey, $hookValue)
|
||||
{
|
||||
if (config('app.debug')) {
|
||||
if (config('app.debug') && has_debugbar()) {
|
||||
Debugbar::log('HOOK === hook_action: ' . $hookKey);
|
||||
}
|
||||
Eventy::action($hookKey, $hookValue);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class Hook
|
|||
*/
|
||||
public function getHook(string $hook, array $params = [], callable $callback = null, string $htmlContent = '')
|
||||
{
|
||||
if (config('app.debug')) {
|
||||
if (config('app.debug') && has_debugbar()) {
|
||||
Debugbar::log("HOOK === @hook: {$hook}");
|
||||
}
|
||||
return $this->get($hook, $params, $callback, $htmlContent);
|
||||
|
|
@ -73,7 +73,7 @@ class Hook
|
|||
*/
|
||||
public function getWrapper(string $hook, array $params = [], callable $callback = null, string $htmlContent = '')
|
||||
{
|
||||
if (config('app.debug')) {
|
||||
if (config('app.debug') && has_debugbar()) {
|
||||
Debugbar::log("HOOK === @hookwrapper: {$hook}");
|
||||
}
|
||||
return $this->get($hook, $params, $callback, $htmlContent);
|
||||
|
|
|
|||
Loading…
Reference in New Issue