Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit c5287b0

Browse files
committed
Перенес добавление системных данных в лог в класс-дебаггер
1 parent 45de64a commit c5287b0

File tree

2 files changed

+83
-73
lines changed

2 files changed

+83
-73
lines changed

module/ggrachdev.debugbar/classes/general/BitrixDebugger/Debugger/NoticeDebugger.php

Lines changed: 82 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* @author ggrachdev
1111
*/
1212
class NoticeDebugger extends ConfigurationDebugger {
13-
13+
1414
protected $log = [];
1515

1616
public function notice(...$item) {
@@ -29,8 +29,87 @@ public function success(...$item) {
2929
return $this->noticeRaw('success', $item);
3030
}
3131

32-
public function getLog(): array {
33-
return $this->log;
32+
/**
33+
* Получить лог
34+
*
35+
* @global type $APPLICATION
36+
* @param bool $needAddSystemData - Нужно ли вернуть так же системные поля
37+
* @return array
38+
*/
39+
public function getLog(bool $needAddSystemData = false): array {
40+
41+
if ($needAddSystemData) {
42+
global $APPLICATION;
43+
44+
$log = $this->log;
45+
46+
if (!empty($_GET)) {
47+
$log['GET'] = [
48+
[
49+
'file' => '',
50+
'line' => '',
51+
'data' => [
52+
$_GET
53+
]
54+
]
55+
];
56+
}
57+
58+
if (!empty($_POST)) {
59+
$log['POST'] = [
60+
[
61+
'file' => '',
62+
'line' => '',
63+
'data' => [
64+
$_POST
65+
]
66+
]
67+
];
68+
}
69+
70+
if (!empty($_COOKIE)) {
71+
$log['COOKIE'] = [
72+
[
73+
'file' => '',
74+
'line' => '',
75+
'data' => [
76+
$_COOKIE
77+
]
78+
]
79+
];
80+
}
81+
82+
if (!empty($_SERVER)) {
83+
$log['SERVER'] = [
84+
[
85+
'file' => '',
86+
'line' => '',
87+
'data' => [
88+
$_SERVER
89+
]
90+
]
91+
];
92+
}
93+
94+
if (!empty($APPLICATION->GetPagePropertyList())) {
95+
$log['BX'] = [
96+
[
97+
'file' => '',
98+
'line' => '',
99+
'data' => [
100+
[
101+
'PAGE_PROPERTIES' => $APPLICATION->GetPagePropertyList(),
102+
'DIR_PROPERTIES' => $APPLICATION->GetDirPropertyList()
103+
]
104+
]
105+
]
106+
];
107+
}
108+
109+
return $log;
110+
} else {
111+
return $this->log;
112+
}
34113
}
35114

36115
/**

module/ggrachdev.debugbar/classes/general/BitrixDebugger/Representer/DebugBarRepresenter.php

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -38,75 +38,6 @@ protected static function renderRightView(): string {
3838
return $view;
3939
}
4040

41-
protected static function getPreparedLog(Debugger $debugger) {
42-
$log = $debugger->getLog();
43-
44-
if (!empty($_GET)) {
45-
$log['GET'] = [
46-
[
47-
'file' => '',
48-
'line' => '',
49-
'data' => [
50-
$_GET
51-
]
52-
]
53-
];
54-
}
55-
56-
if (!empty($_POST)) {
57-
$log['POST'] = [
58-
[
59-
'file' => '',
60-
'line' => '',
61-
'data' => [
62-
$_POST
63-
]
64-
]
65-
];
66-
}
67-
68-
if (!empty($_COOKIE)) {
69-
$log['COOKIE'] = [
70-
[
71-
'file' => '',
72-
'line' => '',
73-
'data' => [
74-
$_COOKIE
75-
]
76-
]
77-
];
78-
}
79-
80-
if (!empty($_SERVER)) {
81-
$log['SERVER'] = [
82-
[
83-
'file' => '',
84-
'line' => '',
85-
'data' => [
86-
$_SERVER
87-
]
88-
]
89-
];
90-
}
91-
92-
if (!empty($APPLICATION->GetPagePropertyList())) {
93-
$log['BX'] = [
94-
[
95-
'file' => '',
96-
'line' => '',
97-
'data' => [
98-
[
99-
'PAGE_PROPERTIES' => $APPLICATION->GetPagePropertyList(),
100-
'DIR_PROPERTIES' => $APPLICATION->GetDirPropertyList()
101-
]
102-
]
103-
]
104-
];
105-
}
106-
107-
return $log;
108-
}
109-
11041
public static function render(Debugger $debugger): string {
11142

11243
global $DBDebug, $APPLICATION;
@@ -118,7 +49,7 @@ public static function render(Debugger $debugger): string {
11849
self::addViewInRightSlot('<a target="_blank" href="/bitrix/admin/fileman_file_edit.php?path=/bitrix/.settings.php&full_src=Y" class="ggrach__debug_bar__right__item type-notice-error" title="В битриксе включен дебаг-режим, он замедляет работу сайта!">D</a>');
11950
}
12051

121-
$log = self::getPreparedLog($debugger);
52+
$log = $debugger->getLog(true);
12253

12354
if (!empty($log)) {
12455
foreach ($log as $typeLog => $arLogs) {

0 commit comments

Comments
 (0)