更新 README 文档,替换为 GeneAgro CMS 使用说明
This commit is contained in:
48
doc/Infrastructure.md
Normal file
48
doc/Infrastructure.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# GeneAgro CMS 基础设施使用说明(数据库/缓存/日志/上传)
|
||||
|
||||
数据库
|
||||
- 配置文件:config/database.php。
|
||||
- 主要参数:type=\"mysqli\",host、user、passwd、port、dbname、prefix(默认 ay_)、charset(utf8)。
|
||||
- 事务:可在 core/convention.php 中配置 database.transaction。
|
||||
- 使用建议:
|
||||
- 为 ay_syslog(系统日志表)创建必要索引(如 time、level)。
|
||||
- 生产环境开启最小化权限账号(仅当前库权限)。
|
||||
|
||||
缓存与会话
|
||||
- 会话存储:默认文件。
|
||||
- 切换为 Memcache:在 core/convention.php 设置 session.handler=\"memcache\",并配置 session.path 与 cache.server(host:port)。
|
||||
- 注意事项:
|
||||
- 需要安装 PHP memcache 扩展;确保 Memcache 服务可用。
|
||||
- Basic::setSessionHandler 中会话路径键名为 \"seesion.path\"(存在拼写问题)。若启用 Memcache 会话,请在 config/config.php 中使用 \"seesion.path\" 键进行覆盖,或修复 Basic.php 将其改为 \"session.path\"。
|
||||
- 缓存:core/cache/*。
|
||||
- Memcache 驱动:通过 cache.handler=\"memcache\" 启用。
|
||||
- 适用场景:热点数据、配置缓存、列表页缓存等。
|
||||
|
||||
日志
|
||||
- 配置:core/convention.php 中 log_record_type(\"db\" 或 \"text\")。
|
||||
- 文本日志:
|
||||
- 位置:log/ 目录,按日期分文件(YYYYMMDD.log)。
|
||||
- 字段:level、content、ip、os、bs、user、time。
|
||||
- 数据库日志:
|
||||
- 表:ay_syslog(通过 core/log/LogDb.php 写入)。
|
||||
- 字段:level、event、ip、os、bs、user、time。
|
||||
- 写入方式:控制器中使用 $this->log($level, $content) 或 Controller::log(...)。
|
||||
|
||||
上传与水印
|
||||
- 入口函数:core/function/file.php::upload。
|
||||
- 配置项:
|
||||
- upload.format:允许上传的扩展名列表(如 jpg|png|gif|bmp|jpeg)。
|
||||
- upload.max_width / upload.max_height:最大尺寸限制。
|
||||
- ico.max_width / ico.max_height:缩略图尺寸限制。
|
||||
- 水印:在后台系统配置开启后,上传函数执行水印处理(需 GD 扩展)。
|
||||
- 存储路径:默认 static/upload/image/ 下(可按业务自定义与扩展)。
|
||||
|
||||
安全与合规
|
||||
- 访问控制:core/convention.php 的 access_rule.* 可限制特定浏览器或操作系统访问。
|
||||
- 会话安全:建议开启仅站点路径会话(session_in_sitepath=true),并启用 HttpOnly 与 Secure(按站点 HTTPS 情况设置)。
|
||||
- 文件权限:确保 runtime、log、static/upload、data 等目录具备写入权限;生产环境最小化权限策略。
|
||||
|
||||
运维建议
|
||||
- 定期归档日志:按日/周归档 text 日志或对 ay_syslog 做清理策略。
|
||||
- 数据库备份:static/backup/sql 可存放备份脚本,建议配合定时任务与远程备份。
|
||||
- 性能优化:合理使用 Memcache;长列表页可结合分页与缓存降低数据库压力。
|
||||
Reference in New Issue
Block a user