Releases: chedong/phpman
v3.7.12: Clear page cache on --build-index (#129)
Fixed
-
#129 (part 3):
--build-index后搜索结果仍为空rebuildSearchIndex()清空了search_fts和search_index_meta表,但未清空cache表。当搜索先于索引重建执行时,空结果被缓存;之后即使重建了索引、修复了 macOS apropos 解析,旧的空缓存仍一直命中。修复:
--build-index时清空整个cache表,因为所有缓存内容(搜索结果、man page 搜索回退等)都依赖 FTS5 数据。
Previous fixes for #129
- v3.7.10:
rebuildSearchIndex()正则\s+\(→\s*\( - v3.7.11:
parseAproposLine()+getSearchPage()搜索解析同样修复
Test
- 296/296 单元和集成测试全部通过
v3.7.11: Fix #129 macOS apropos search + index parsing
Fixed
-
#129 (part 2): macOS apropos 搜索功能也返回空结果
除了
--build-index之外,搜索功能中的parseAproposLine()和getSearchPage()JSON/MCP 结果解析也存在同样的 macOS/BSD 兼容性问题。共修复 5 处正则:\s+\(→\s*\(。修复位置:
parseAproposLine()— Linux em-dash 和 dash 两种格式getSearchPage()JSON/MCP 解析 — 3 处内联正则
Previous (v3.7.10)
rebuildSearchIndex()—--build-index索引构建时的解析
Test
- 296/296 单元和集成测试全部通过
v3.7.19: Filter apropos junk + README screenshot update
v3.7.18: Filter punctuation chars and troff leakage from apropos
Fixed
- 过滤标点符号单字符命令名 — apropos 返回的 shell builtins(
!,%,.,:,@,{,}等)不再作为 man page 入口显示,保留[(shell test 命令) - 过滤 troff 格式化泄漏 — 损坏的 man page 数据(如
."======================)不再出现
Added
isValidManPageName()— 统一验证 apropos 条目名称合法性:必须包含字母或数字,或为[
Test
- 296/296 单元和集成测试全部通过
v3.7.17: Dynamic UA header + tldr 404 warning fix
Fixed
- tldr HTTP 404 warning 泄漏 —
file_get_contents()遇 HTTP 404产生 PHP WARNING 输出到页面,添加@抑制 - User-Agent 使用 GIT_DESCRIBE — tldr fetch 的
User-Agent头从硬编码phpMan/2.2改为动态phpMan/+ GIT_DESCRIBE
Test
- 296/296 单元和集成测试全部通过
v3.7.16: Suppress PHP warnings on tldr 404
Fixed
-
TLDR HTTP 404 警告泄漏到页面输出
fetchTldrPages()和fetchCheatShTldr()中使用file_get_contents()获取远程 tldr 内容时,HTTP 404 会产生 PHP WARNING 直接输出到页面,显示在 man page 内容上方。修复:添加
@抑制符,因为代码已正确通过=== false判断处理失败情况。404 对大多数没有 tldr-pages 条目的 man page 是正常预期行为。
Test
- 296/296 单元和集成测试全部通过
v3.7.15: Dedup apropos output for macOS (#129)
Fixed
-
#129 (part 6): macOS apropos 返回重复条目
macOS 上 man page 同时存在于
/usr/share/man/(系统)和/opt/homebrew/share/man/(Homebrew),导致apropos对每条记录返回两次。section 7 的 79 行中有 32 行是重复的,搜索结果每条都显示两遍。修复:
rebuildSearchIndex()和getSearchPage()中exec(apropos)后加array_unique()去重。
Complete #129 fix history
- v3.7.10:
rebuildSearchIndex()macOS regex - v3.7.11: Search parsing regex
- v3.7.12: Cache clearing
- v3.7.13: Multi-command split (BSD section 9)
- v3.7.14: Markdown/HTML render split
- v3.7.15: apropos duplicate dedup
Test
- 296/296 单元和集成测试全部通过
v3.7.14: Markdown/HTML search renders multi-name apropos lines
Fixed
-
#129 (part 5): Markdown/HTML 搜索渲染支持多命令拆分
Markdown 和 HTML(非 JSON)搜索渲染路径仍在使用内联
preg_replace做链接化,只会匹配行内第一个命令名。多命令行如:colorsync.useragent(8), colorsync.usergaent (8) — ColorSync User Agent只有
colorsync.useragent被正确链接,第二个命令colorsync.usergaent显示为纯文本,且链接指向错误的组合 URL。修复后统一使用
parseAproposLines()拆分为独立<li>条目,每个命令都有正确的链接。
Code cleanup
- 消除 ~40 行 Markdown/HTML 内联
preg_replace模式匹配代码
Test
- 296/296 单元和集成测试全部通过
v3.7.13: Split multi-command apropos lines (BSD section 9)
Fixed
-
#129 (part 4): BSD section 9 多命令合并行解析
BSD kernel man pages (section 9) 的 apropos 输出将多个相关命令合并在一行:
backtrace(9), backtrace_packed(9), backtrace_user (9) — description修复前整行被当作一个名称混乱的条目。修复后正确拆分为 3 条独立记录。
Changed
- 新增
parseAproposLines()— 统一的 apropos 行解析函数,自动处理逗号分隔的多命令格式 - 消除重复代码 — 4 处散落的 apropos 行内联正则(~50 行)全部收敛到此函数
Previous fixes for #129
- v3.7.10:
rebuildSearchIndex()正则兼容 macOS apropos 格式 - v3.7.11:
parseAproposLine()+getSearchPage()搜索解析修复 - v3.7.12:
--build-index清空 page cache
Test
- 296/296 单元和集成测试全部通过
v3.7.10: Fix macOS apropos parsing
Fixed
-
#129 macOS:
php phpMan.php --build-index索引 man page 为 0 条macOS (BSD)
apropos输出格式为name(section)(无空格),与 Linux 的name (section)(有空格) 不同。rebuildSearchIndex()中的正则要求 name 和(section)之间必须有空白字符\s+,导致 macOS 上所有 man page 条目被静默跳过。修复:将正则中的
\s+改为\s*,同时兼容两种格式。修复后 macOS 上成功索引 6799 条 man page。
Test
- 296/296 单元和集成测试全部通过