Repository navigation
Expand file tree
/
Copy pathxoops_version.php
More file actions
454 lines (409 loc) · 15.2 KB
/
Copy pathxoops_version.php
File metadata and controls
454 lines (409 loc) · 15.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
<?php
/**
* DebugBar Module for XOOPS 2.7.0
*
* Provides PHP DebugBar integration for in-browser debugging.
* Ported from XOOPS 2.6.0 modules/debugbar.
*
* @copyright (c) 2000-2026 XOOPS Project (https://xoops.org)
* @license GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html)
* @author trabis <lusopoemas@gmail.com>
* @author Richard Griffith <richard@geekwright.com>
*/
defined('XOOPS_ROOT_PATH') || exit('Restricted access');
// The preference titles below are constant NAMES resolved by the system module
// when it renders the form. The line_break dividers additionally need their
// values available while this file is being read, so load the language here
// rather than relying on the caller having done it.
xoops_loadLanguage('modinfo', basename(__DIR__));
$modversion = [];
// --- Module Info ---
$modversion['version'] = '1.4.1';
$modversion['release_date'] = '2026/08/08';
$modversion['name'] = _MI_DEBUGBAR_NAME;
$modversion['description'] = _MI_DEBUGBAR_DSC;
$modversion['author'] = 'XOOPS Project';
$modversion['credits'] = 'trabis, Richard Griffith';
$modversion['license'] = 'GNU GPL 2.0 or later';
$modversion['license_url'] = 'https://www.gnu.org/licenses/gpl-2.0.html';
$modversion['official'] = 1;
$modversion['image'] = 'assets/images/logoModule.png'; // optional, module works without it
$modversion['dirname'] = 'debugbar';
$modversion['tables'] = ['debugbar_profiles'];
$modversion['sqlfile'] = ['mysql' => 'sql/mysql.sql'];
// --- Min Requirements ---
$modversion['min_php'] = '8.2.0';
// 2.7.0, not 2.7.3, deliberately. Everything this module needs from the 2.7.3 debug API
// -- xoops_isDeveloperRequest(), xoops_getDebugConfig(), XOOPS_TRACY_STATUS -- is reached
// through function_exists()/defined() guards with working fallbacks, so on 2.7.0-2.7.2 the
// module runs with the database-backed Debug Mode and simply does not offer the Tracy
// control. Raising the floor to 2.7.3 would make those fallbacks unreachable while leaving
// them in the source, which is how you end up unable to tell which branch is load-bearing.
$modversion['min_xoops'] = '2.7.0';
// --- Admin ---
$modversion['hasAdmin'] = 1;
$modversion['system_menu'] = 1;
$modversion['adminindex'] = 'admin/index.php';
$modversion['adminmenu'] = 'admin/menu.php';
// --- Install/Update callbacks ---
$modversion['onInstall'] = 'include/install.php';
$modversion['onUpdate'] = 'include/install.php';
$modversion['help'] = 'page=help';
$modversion['helpsection'] = [
['name' => _MI_DEBUGBAR_OVERVIEW, 'link' => 'page=help'],
['name' => _MI_DEBUGBAR_DISCLAIMER, 'link' => 'page=disclaimer'],
['name' => _MI_DEBUGBAR_LICENSE, 'link' => 'page=license'],
['name' => _MI_DEBUGBAR_SUPPORT, 'link' => 'page=support'],
];
// --- Module Config ---
// Preferences are ordered into 7 contiguous sections, each introduced by a
// `line_break` divider so they render as labelled groups on the single (flat)
// preferences page. Divider titles use _MI_DEBUGBAR_HDR_* constants whose
// values carry <strong> markup: XOOPS emits a constant title unescaped, so it
// renders bold, whereas a plain-string title would be HTML-escaped and show
// the tags literally.
//
// Order is load-bearing. XoopsConfigItem rows have no explicit weight column,
// so the form renders them in insertion order — a divider only labels the
// block that follows it because that block is inserted immediately after.
// Moving an entry between sections here moves it on the page.
// ============================= 1. General =============================
$modversion['config'][] = [
'name' => 'hdr_general',
'title' => '_MI_DEBUGBAR_HDR_GENERAL',
'description' => '',
'formtype' => 'line_break',
'valuetype' => 'text',
'default' => 'even',
'category' => 'group_header',
];
$modversion['config'][] = [
'name' => 'debugbar_enable',
'title' => '_MI_DEBUGBAR_ENABLE',
'description' => '',
'formtype' => 'yesno',
'valuetype' => 'int',
'default' => 1,
];
$modversion['config'][] = [
'name' => 'debug_smarty_enable',
'title' => '_MI_DEBUGBAR_SMARTYDEBUG',
'description' => '',
'formtype' => 'yesno',
'valuetype' => 'int',
'default' => 1,
];
$modversion['config'][] = [
'name' => 'debug_files_enable',
'title' => '_MI_DEBUGBAR_FILESDEBUG',
'description' => '_MI_DEBUGBAR_FILESDEBUG_DSC',
'formtype' => 'yesno',
'valuetype' => 'int',
'default' => 0,
];
// How many backtrace frames each message renders in the bar. The full trace is
// still written to the log file; this only bounds what the toolbar draws.
$modversion['config'][] = [
'name' => 'trace_depth',
'title' => '_MI_DEBUGBAR_TRACE_DEPTH',
'description' => '_MI_DEBUGBAR_TRACE_DEPTH_DSC',
'formtype' => 'textbox',
'valuetype' => 'int',
'default' => 25,
];
// Ignored when php.ini sets xdebug.file_link_format, which already tells the
// whole stack which editor to open.
$modversion['config'][] = [
'name' => 'editor_link',
'title' => '_MI_DEBUGBAR_EDITOR_LINK',
'description' => '_MI_DEBUGBAR_EDITOR_LINK_DSC',
'formtype' => 'select',
'valuetype' => 'text',
'default' => 'phpstorm',
'options' => [
'VS Code' => 'vscode',
'VS Code Insiders' => 'vscode-insiders',
'VSCodium' => 'vscodium',
'PhpStorm' => 'phpstorm',
'IntelliJ IDEA' => 'idea',
'Cursor' => 'cursor',
'Windsurf' => 'windsurf',
'Zed' => 'zed',
'Sublime Text' => 'sublime',
'Netbeans' => 'netbeans',
'Atom' => 'atom',
'Emacs' => 'emacs',
'MacVim' => 'macvim',
'Nova' => 'nova',
'Xdebug protocol' => 'xdebug',
],
];
// ================= 2. Integrations & external tools =================
$modversion['config'][] = [
'name' => 'hdr_integrations',
'title' => '_MI_DEBUGBAR_HDR_INTEGRATIONS',
'description' => '',
'formtype' => 'line_break',
'valuetype' => 'text',
'default' => 'odd',
'category' => 'group_header',
];
$modversion['config'][] = [
'name' => 'xdebug_button_enable',
'title' => '_MI_DEBUGBAR_XDEBUG_BUTTON',
'description' => '_MI_DEBUGBAR_XDEBUG_BUTTON_DSC',
'formtype' => 'yesno',
'valuetype' => 'int',
'default' => 1,
];
$modversion['config'][] = [
'name' => 'ray_enable',
'title' => '_MI_DEBUGBAR_RAY_ENABLE',
'description' => '_MI_DEBUGBAR_RAY_ENABLE_DSC',
'formtype' => 'yesno',
'valuetype' => 'int',
'default' => 0,
];
$modversion['config'][] = [
'name' => 'monolog_enable',
'title' => '_MI_DEBUGBAR_MONOLOG_ENABLE',
'description' => '_MI_DEBUGBAR_MONOLOG_ENABLE_DSC',
'formtype' => 'yesno',
'valuetype' => 'int',
'default' => 1,
];
$modversion['config'][] = [
'name' => 'monolog_level',
'title' => '_MI_DEBUGBAR_MONOLOG_LEVEL',
'description' => '_MI_DEBUGBAR_MONOLOG_LEVEL_DSC',
'formtype' => 'select',
'valuetype' => 'text',
'default' => 'warning',
'options' => [
_MI_DEBUGBAR_LEVEL_DEBUG => 'debug', _MI_DEBUGBAR_LEVEL_INFO => 'info',
_MI_DEBUGBAR_LEVEL_NOTICE => 'notice', _MI_DEBUGBAR_LEVEL_WARNING => 'warning',
_MI_DEBUGBAR_LEVEL_ERROR => 'error', _MI_DEBUGBAR_LEVEL_CRITICAL => 'critical',
],
];
// ========================== 3. Queries & SQL ==========================
$modversion['config'][] = [
'name' => 'hdr_queries',
'title' => '_MI_DEBUGBAR_HDR_QUERIES',
'description' => '',
'formtype' => 'line_break',
'valuetype' => 'text',
'default' => 'even',
'category' => 'group_header',
];
$modversion['config'][] = [
'name' => 'query_log_mode',
'title' => '_MI_DEBUGBAR_QUERYMODE',
'description' => '_MI_DEBUGBAR_QUERYMODE_DSC',
'formtype' => 'select',
'valuetype' => 'int',
'default' => 1,
'options' => [_MI_DEBUGBAR_QUERYMODE_ALL => 0, _MI_DEBUGBAR_QUERYMODE_SLOW => 1],
];
$modversion['config'][] = [
'name' => 'slow_query_threshold',
'title' => '_MI_DEBUGBAR_SLOWQUERY',
'description' => '_MI_DEBUGBAR_SLOWQUERY_DSC',
'formtype' => 'textbox',
'valuetype' => 'text',
'default' => '0.05',
];
$modversion['config'][] = [
'name' => 'nplus1_threshold',
'title' => '_MI_DEBUGBAR_NPLUS1_THRESHOLD',
'description' => '_MI_DEBUGBAR_NPLUS1_THRESHOLD_DSC',
'formtype' => 'textbox',
'valuetype' => 'int',
'default' => 5,
];
$modversion['config'][] = [
'name' => 'explain_slow',
'title' => '_MI_DEBUGBAR_EXPLAIN_SLOW',
'description' => '_MI_DEBUGBAR_EXPLAIN_SLOW_DSC',
'formtype' => 'yesno',
'valuetype' => 'int',
'default' => 1,
];
$modversion['config'][] = [
'name' => 'explain_on_demand',
'title' => '_MI_DEBUGBAR_EXPLAIN_ON_DEMAND',
'description' => '_MI_DEBUGBAR_EXPLAIN_ON_DEMAND_DSC',
'formtype' => 'yesno',
'valuetype' => 'int',
'default' => 0,
];
// =============== 4. Performance (thresholds + budgets) ===============
$modversion['config'][] = [
'name' => 'hdr_performance',
'title' => '_MI_DEBUGBAR_HDR_PERFORMANCE',
'description' => '',
'formtype' => 'line_break',
'valuetype' => 'text',
'default' => 'odd',
'category' => 'group_header',
];
$modversion['config'][] = [
'name' => 'slow_request_threshold',
'title' => '_MI_DEBUGBAR_SLOWREQUEST',
'description' => '_MI_DEBUGBAR_SLOWREQUEST_DSC',
'formtype' => 'textbox',
'valuetype' => 'text',
'default' => '1.0',
];
$modversion['config'][] = [
'name' => 'memory_threshold',
'title' => '_MI_DEBUGBAR_MEMORY_THRESHOLD',
'description' => '_MI_DEBUGBAR_MEMORY_THRESHOLD_DSC',
'formtype' => 'textbox',
'valuetype' => 'int',
'default' => 0,
];
// Performance budgets (0 disables an individual check).
$modversion['config'][] = [
'name' => 'budget_queries',
'title' => '_MI_DEBUGBAR_BUDGET_QUERIES',
'description' => '_MI_DEBUGBAR_BUDGET_DSC',
'formtype' => 'textbox',
'valuetype' => 'int',
'default' => 30,
];
$modversion['config'][] = [
'name' => 'budget_query_ms',
'title' => '_MI_DEBUGBAR_BUDGET_QUERY_MS',
'description' => '_MI_DEBUGBAR_BUDGET_DSC',
'formtype' => 'textbox',
'valuetype' => 'int',
'default' => 120,
];
$modversion['config'][] = [
'name' => 'budget_boot_ms',
'title' => '_MI_DEBUGBAR_BUDGET_BOOT_MS',
'description' => '_MI_DEBUGBAR_BUDGET_DSC',
'formtype' => 'textbox',
'valuetype' => 'int',
'default' => 100,
];
$modversion['config'][] = [
'name' => 'budget_total_ms',
'title' => '_MI_DEBUGBAR_BUDGET_TOTAL_MS',
'description' => '_MI_DEBUGBAR_BUDGET_DSC',
'formtype' => 'textbox',
'valuetype' => 'int',
'default' => 300,
];
$modversion['config'][] = [
'name' => 'budget_memory_mb',
'title' => '_MI_DEBUGBAR_BUDGET_MEMORY_MB',
'description' => '_MI_DEBUGBAR_BUDGET_DSC',
'formtype' => 'textbox',
'valuetype' => 'int',
'default' => 32,
];
$modversion['config'][] = [
'name' => 'budget_payload_kb',
'title' => '_MI_DEBUGBAR_BUDGET_PAYLOAD_KB',
'description' => '_MI_DEBUGBAR_BUDGET_DSC',
'formtype' => 'textbox',
'valuetype' => 'int',
'default' => 250,
];
// ====================== 5. Profiles & Analytics ======================
$modversion['config'][] = [
'name' => 'hdr_profiles',
'title' => '_MI_DEBUGBAR_HDR_PROFILES',
'description' => '',
'formtype' => 'line_break',
'valuetype' => 'text',
'default' => 'even',
'category' => 'group_header',
];
$modversion['config'][] = [
'name' => 'profiles_enable',
'title' => '_MI_DEBUGBAR_PROFILES_ENABLE',
'description' => '_MI_DEBUGBAR_PROFILES_ENABLE_DSC',
'formtype' => 'yesno',
'valuetype' => 'int',
'default' => 1,
];
$modversion['config'][] = [
'name' => 'profiles_retention_days',
'title' => '_MI_DEBUGBAR_PROFILES_RETENTION',
'description' => '_MI_DEBUGBAR_PROFILES_RETENTION_DSC',
'formtype' => 'textbox',
'valuetype' => 'int',
'default' => 7,
];
$modversion['config'][] = [
'name' => 'profiles_max_rows',
'title' => '_MI_DEBUGBAR_PROFILES_MAX_ROWS',
'description' => '_MI_DEBUGBAR_PROFILES_MAX_ROWS_DSC',
'formtype' => 'textbox',
'valuetype' => 'int',
'default' => 10000,
];
// RUM web-vitals beacon (feeds the Analytics page — kept with Profiles).
$modversion['config'][] = [
'name' => 'rum_enable',
'title' => '_MI_DEBUGBAR_RUM_ENABLE',
'description' => '_MI_DEBUGBAR_RUM_ENABLE_DSC',
'formtype' => 'yesno',
'valuetype' => 'int',
'default' => 1,
];
// ============================= 6. Privacy =============================
$modversion['config'][] = [
'name' => 'hdr_privacy',
'title' => '_MI_DEBUGBAR_HDR_PRIVACY',
'description' => '',
'formtype' => 'line_break',
'valuetype' => 'text',
'default' => 'odd',
'category' => 'group_header',
];
$modversion['config'][] = [
'name' => 'copy_redact',
'title' => '_MI_DEBUGBAR_COPY_REDACT',
'description' => '_MI_DEBUGBAR_COPY_REDACT_DSC',
'formtype' => 'yesno',
'valuetype' => 'int',
'default' => 1,
];
// ================ 7. Advanced: core-seam collectors ================
$modversion['config'][] = [
'name' => 'hdr_advanced',
'title' => '_MI_DEBUGBAR_HDR_ADVANCED',
'description' => '',
'formtype' => 'line_break',
'valuetype' => 'text',
'default' => 'even',
'category' => 'group_header',
];
// tap() collectors (Events / Templates)
//
// A collect_authz preference was declared here and removed before release: it
// promised an Authz tab logging group-permission checks, but no seam exists to
// collect them from a module. XoopsGroupPermHandler::checkRight() fires no
// preload event, and xoops_getHandler() caches handlers in a function-local
// static, so the handler cannot be decorated the way PreloadEventSpy decorates
// the event table or TemplateResource hooks Smarty. Implementing it needs a
// core-side seam first; until then the toggle would have done nothing.
$modversion['config'][] = [
'name' => 'collect_events',
'title' => '_MI_DEBUGBAR_COLLECT_EVENTS',
'description' => '_MI_DEBUGBAR_COLLECT_EVENTS_DSC',
'formtype' => 'yesno',
'valuetype' => 'int',
'default' => 0,
];
$modversion['config'][] = [
'name' => 'collect_templates',
'title' => '_MI_DEBUGBAR_COLLECT_TEMPLATES',
'description' => '_MI_DEBUGBAR_COLLECT_TEMPLATES_DSC',
'formtype' => 'yesno',
'valuetype' => 'int',
'default' => 0,
];