3x-ui/docs/Tasktracking/2026-04-15-uninstall-mariadb-option.md
root eca9b219cf docs: add missing task tracking records for multi-node and traffic fixes
Add task tracking records for commits that were missing documentation:
- 2026-04-10: multi-node backend foundation (7 commits)
- 2026-04-15: improve mariadb flow and traffic flush
- 2026-04-23: install cron before acme.sh
- 2026-04-24: resolve client traffic InboundId from DB
- 2026-04-24: fix traffic flush blocked by stale inboundId=0 delta
2026-04-24 03:04:15 +08:00

31 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 任务记录uninstall-mariadb-option
- 日期2026-04-15
- 关联模块x-ui uninstall flow / database cleanup / test script
- 变更类型:优化
## 背景
卸载流程原先只移除面板服务与文件,不处理 MariaDB 业务库、业务账号和本机 MariaDB 包,用户在希望彻底清理时需要手动处理。
## 修改内容
-`x-ui.sh``uninstall()` 中新增交互项:`是否删除数据库并卸载本机 MariaDB`。
- 当当前数据库类型为 MariaDB 且 host 为本机地址(`127.0.0.1`/`localhost`/`::1`)时:
- 删除业务库与业务账号(`localhost`、`127.0.0.1`、`::1`)。
- 卸载本机 MariaDB 服务与相关软件包。
- 当数据库为远程 MariaDB 时,输出提示并跳过数据库删除与卸载,避免误删远程资源。
- 新增 `remove_local_mariadb_data``uninstall_local_mariadb_packages` 两个函数。
- 更新 `tests/mariadb_install_switch_test.sh`,增加新卸载逻辑关键文本断言。
## 影响范围
- 影响文件:`x-ui.sh`、`tests/mariadb_install_switch_test.sh`。
- 不影响面板安装流程、数据库切换流程、数据库结构。
- 仅在卸载流程中新增可选数据库清理能力。
## 验证情况
- 执行 `bash -n x-ui.sh`,通过。
- 执行 `bash -n install.sh`,通过。
- 执行 `bash tests/mariadb_install_switch_test.sh`,通过。
## 风险与后续
- 用户若选择删除数据库,相关业务数据将不可恢复。
- 后续可增加二次确认,显示将删除的数据库名和用户名,以进一步降低误操作风险。