diff --git a/includes/kernel.php b/includes/kernel.php index 4bedf59ae..c86619770 100644 --- a/includes/kernel.php +++ b/includes/kernel.php @@ -114,8 +114,8 @@ } if (DB::isConnected(DB_AOWOW)) - DB::Aowow()->query('INSERT INTO ?_errors (`date`, `version`, `phpError`, `file`, `line`, `query`, `userGroups`, `message`) VALUES (UNIX_TIMESTAMP(), ?d, ?d, ?, ?d, ?, ?d, ?) ON DUPLICATE KEY UPDATE `date` = UNIX_TIMESTAMP()', - AOWOW_REVISION, $errNo, $errFile, $errLine, CLI ? 'CLI' : ($_SERVER['QUERY_STRING'] ?? ''), User::$groups, $errStr + DB::Aowow()->query('INSERT INTO ?_errors (`date`, `version`, `phpError`, `file`, `line`, `query`, `post`, `userGroups`, `message`) VALUES (UNIX_TIMESTAMP(), ?d, ?d, ?, ?d, ?, ?d, ?) ON DUPLICATE KEY UPDATE `date` = UNIX_TIMESTAMP()', + AOWOW_REVISION, $errNo, $errFile, $errLine, CLI ? 'CLI' : ($_SERVER['QUERY_STRING'] ?? ''), empty($_POST) ? '' : http_build_query($_POST), User::$groups, $errStr ); if (CLI) @@ -130,8 +130,8 @@ set_exception_handler(function ($e) { if (DB::isConnected(DB_AOWOW)) - DB::Aowow()->query('INSERT INTO ?_errors (`date`, `version`, `phpError`, `file`, `line`, `query`, `userGroups`, `message`) VALUES (UNIX_TIMESTAMP(), ?d, ?d, ?, ?d, ?, ?d, ?) ON DUPLICATE KEY UPDATE `date` = UNIX_TIMESTAMP()', - AOWOW_REVISION, $e->getCode(), $e->getFile(), $e->getLine(), CLI ? 'CLI' : ($_SERVER['QUERY_STRING'] ?? ''), User::$groups, $e->getMessage() + DB::Aowow()->query('INSERT INTO ?_errors (`date`, `version`, `phpError`, `file`, `line`, `query`, `post`, `userGroups`, `message`) VALUES (UNIX_TIMESTAMP(), ?d, ?d, ?, ?d, ?, ?d, ?) ON DUPLICATE KEY UPDATE `date` = UNIX_TIMESTAMP()', + AOWOW_REVISION, $e->getCode(), $e->getFile(), $e->getLine(), CLI ? 'CLI' : ($_SERVER['QUERY_STRING'] ?? ''), empty($_POST) ? '' : http_build_query($_POST), User::$groups, $e->getMessage() ); if (CLI) @@ -149,8 +149,8 @@ if ($e = error_get_last()) { if (DB::isConnected(DB_AOWOW)) - DB::Aowow()->query('INSERT INTO ?_errors (`date`, `version`, `phpError`, `file`, `line`, `query`, `userGroups`, `message`) VALUES (UNIX_TIMESTAMP(), ?d, ?d, ?, ?d, ?, ?d, ?) ON DUPLICATE KEY UPDATE `date` = UNIX_TIMESTAMP()', - AOWOW_REVISION, $e['type'], $e['file'], $e['line'], CLI ? 'CLI' : ($_SERVER['QUERY_STRING'] ?? ''), User::$groups, $e['message'] + DB::Aowow()->query('INSERT INTO ?_errors (`date`, `version`, `phpError`, `file`, `line`, `query`, `post`, `userGroups`, `message`) VALUES (UNIX_TIMESTAMP(), ?d, ?d, ?, ?d, ?, ?d, ?) ON DUPLICATE KEY UPDATE `date` = UNIX_TIMESTAMP()', + AOWOW_REVISION, $e['type'], $e['file'], $e['line'], CLI ? 'CLI' : ($_SERVER['QUERY_STRING'] ?? ''), empty($_POST) ? '' : http_build_query($_POST), User::$groups, $e['message'] ); if (CLI || User::isInGroup(U_GROUP_EMPLOYEE)) diff --git a/setup/db_structure.sql b/setup/db_structure.sql index 9635f9a79..0457bd0a7 100644 --- a/setup/db_structure.sql +++ b/setup/db_structure.sql @@ -797,6 +797,7 @@ CREATE TABLE `aowow_errors` ( `file` varchar(150) NOT NULL, `line` smallint unsigned NOT NULL, `query` varchar(250) NOT NULL, + `post` text NOT NULL, `userGroups` smallint unsigned NOT NULL, `message` text DEFAULT NULL, PRIMARY KEY (`file`,`line`,`phpError`,`version`,`userGroups`) @@ -3320,7 +3321,7 @@ UNLOCK TABLES; LOCK TABLES `aowow_dbversion` WRITE; /*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */; -INSERT INTO `aowow_dbversion` VALUES (1720523765,0,NULL,NULL); +INSERT INTO `aowow_dbversion` VALUES (1720969086,0,NULL,NULL); /*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */; UNLOCK TABLES; diff --git a/setup/updates/1720969085_01.sql b/setup/updates/1720969085_01.sql new file mode 100644 index 000000000..87c9c1822 --- /dev/null +++ b/setup/updates/1720969085_01.sql @@ -0,0 +1,3 @@ +ALTER TABLE `aowow_errors` + DROP COLUMN IF EXISTS `post`, + ADD COLUMN `post` text NOT NULL AFTER `query`;