mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
feat(admin): add transparent debug error-log mode
Add an admin-controlled debug mode that captures PHP errors of all players into var/log/debug-players.log, to hunt remaining PHP 8.3 bugs from real play sessions. Fully transparent to players: no redirect, no gameplay change, errors are never displayed. - DB: new debug_log table (one row), mirroring the maintenance pattern. - Database: getDebugMode()/setDebugMode()/setDebugSettings(), defensive when the table is absent (no blank page). - Session: register a custom error + shutdown handler when enabled; the handler runs even when php.ini error_reporting masks warnings/notices, so capture is complete without a Docker rebuild. Auto-disables after a configurable window. - DebugErrorLogger: size-capped file with a single .log.1 rotation, honours the @ operator, never throws. - Admin: new "Debug Error Log" page (levels, size cap, auto-off, on-page viewer, clear, download) + debugLog action mod. - Menu: admin-only quick on/off widget (TZ_DEBUG_ON/OFF, EN/FR/RO). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
committed by
Catalin Novgorodschi
parent
63c94fa961
commit
827354a622
@@ -1828,3 +1828,28 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%maintenance` (
|
||||
--
|
||||
INSERT INTO `%PREFIX%maintenance` (`id`, `active`, `message`, `started_by`, `started_at`) VALUES
|
||||
(1, 0, 'Server in maintenance', NULL, NULL);
|
||||
|
||||
--
|
||||
-- Table structure for table `%PREFIX%debug_log`
|
||||
-- Admin-controlled PHP error capture (transparent to players). One row (id=1).
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `%PREFIX%debug_log` (
|
||||
`id` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`active` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`lvl_warning` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`lvl_notice` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`lvl_deprecated` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`lvl_fatal` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`max_size_mb` int(11) NOT NULL DEFAULT 5,
|
||||
`auto_off_hours` int(11) NOT NULL DEFAULT 6,
|
||||
`started_by` int(11) DEFAULT NULL,
|
||||
`started_at` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Dumping data for table `%PREFIX%debug_log`
|
||||
--
|
||||
INSERT INTO `%PREFIX%debug_log` (`id`, `active`, `lvl_warning`, `lvl_notice`, `lvl_deprecated`, `lvl_fatal`, `max_size_mb`, `auto_off_hours`, `started_by`, `started_at`) VALUES
|
||||
(1, 0, 1, 1, 1, 1, 5, 6, NULL, NULL);
|
||||
|
||||
Reference in New Issue
Block a user