fix: 修复 revbotservice Web 路径加载失败并增强 bothost 远端 PHP 报错可见性#219
Merged
amarillonmc merged 2 commits intonouveaufrom Feb 8, 2026
Merged
fix: 修复 revbotservice Web 路径加载失败并增强 bothost 远端 PHP 报错可见性#219amarillonmc merged 2 commits intonouveaufrom
amarillonmc merged 2 commits intonouveaufrom
Conversation
🤖 Augment PR SummarySummary: 修复了
🤖 Was this summary useful? React with 👍 or 👎 |
| $id = 0; | ||
| $dir = GAME_ROOT.'./bot/lock/'; | ||
| if(!is_dir($dir)) { | ||
| mkdir($dir, 0777, true); |
| include GAME_ROOT . './include/game.func.php'; | ||
| include GAME_ROOT . './bot/revbot.func.php'; | ||
|
|
||
| $gameRoot = dirname(__DIR__).DIRECTORY_SEPARATOR; |
| chdir($gameRoot); | ||
| } | ||
|
|
||
| require_once $gameRoot.'include/common.inc.php'; |
There was a problem hiding this comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
error_log指出bot/revbotservice.php在 Web 环境下以相对路径包含./include/common.inc.php失败,导致GAME_ROOT未定义并触发后续 fatal 错误。Description
bot/revbotservice.php启动目录与包含路径问题:基于dirname(__DIR__)计算游戏根目录并chdir($gameRoot),改用require_once绝对路径加载依赖。revbotservice.php启动时确保bot/lock/目录存在并自动创建以避免scandir/touch失败,并修正array_search($botid, ...)为array_search($id, ...)的变量误用。bothost/main.py的行为调整:在流式日志解析中识别Fatal error/Warning:/Uncaught Error,将对应 worker 标记为remote_php_error并写入last_error,同时保留并在周期汇总中打印last_error。bothost/README.md、bothost/TASKS.md与bothost/config.example.json,在 README 中补充了关于include(...common.inc.php)错误的诊断说明及代理/TLS 建议(如disable_env_proxy、insecure_skip_tls_verify)。Testing
php -l bot/revbotservice.php,结果为No syntax errors detected(通过)。python -m py_compile bothost/main.py(通过)。python bothost/main.py -h并确认输出用法说明(通过)。Codex Task