Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化同步逻辑及修复数据库脚本错误 #54

Merged
merged 2 commits into from
Jun 8, 2021

Conversation

qicz
Copy link
Contributor

@qicz qicz commented Jun 8, 2021

No description provided.

@sanluan sanluan merged commit 1b09d40 into sanluan:master Jun 8, 2021
@sanluan
Copy link
Owner

sanluan commented Jun 8, 2021

尽可能在开发分支提交,因为CMS旧版本可以直接升级到新版本的,有些用户可能不会执行新版本的全量脚本 只会执行增量脚本
还有些用户可能执行了主分支的全量脚本 然后又执行增量脚本 就会导致一些数据冲突

@sanluan
Copy link
Owner

sanluan commented Jul 7, 2021

在您得功能基础上 我进行了修改 增加了windows同步脚本 将脚本移动到了 用户可修改得范围以外,git仓库地址也通过参数传递
放在了 站点管理中

@qicz
Copy link
Contributor Author

qicz commented Jul 7, 2021

@sanluan 实际上,这个地方的处理,透明脚本才是最优的。我原来的设计是因为进行用户侧的配置,需要改动页面,所以借用了一个外部的shell来进行。这里大可以直接在后端服务中调用git进行,无需脚本,这样对脚本角度来说就不存在bat和sh的差异了

@sanluan
Copy link
Owner

sanluan commented Jul 7, 2021

管理员可以通过在后台修改出危险得模板 sql 脚本 会被很多安全公司当作安全漏洞。程序以前有执行sql的入口 也被迫改成了 固定sql 动态参数得方式
比如这个 #29

@qicz
Copy link
Contributor Author

qicz commented Jul 7, 2021

@sanluan 刚才看了一下实际的效果。现在你改成对数据目录的完整sync到repo了吧。

其实呢,我的初衷是一个repo,多个分支,不同分支对应不同的目录。因为不排除多人协作情况。

所以只需要提供repo地址,对应的分支,甚至可以明确规范就是template,task,page分支。也就是只需要配置repo即可。

这在site中配置,只需要提供repo地址即可。

另外就是同步的位置,放到site中去“执行脚本”,“执行脚本”这个有点大了,实际功能是同步。同步的位置,其实在“模板”、“业页面”、“任务”顶部最合适。 这也是我原先放到“开发”的原因,不过因为需要改动“模板”、“业页面”、“任务”顶部,我对相关模块不熟,所以没有那样做。

image
image

此外,可以在页面展示时,把.git目录过滤掉,不展示

@sanluan
Copy link
Owner

sanluan commented Jul 7, 2021

.git目录 放到网站文件管理中 就可以被公开访问到 在模板目录中
也是改了好几版 就成现在 执行脚本了 目前这样确实没有之前得对于单个站点维护人员友好 再就是很多服务器不一定有 git 命令 太明显会造成用户困扰

@sanluan
Copy link
Owner

sanluan commented Jul 7, 2021

可以加群 或者 加我QQ 经常交流哈

@qicz
Copy link
Contributor Author

qicz commented Jul 7, 2021

.git目录 放到网站文件管理中 就可以被公开访问到 在模板目录中
也是改了好几版 就成现在 执行脚本了 目前这样确实没有之前得对于单个站点维护人员友好 再就是很多服务器不一定有 git 命令 太明显会造成用户困扰

根据repo的配置来决定是不是需要显示同步按钮即可了。其实可以在新建站点的时候把仓库repo关联起来。在触发同步的时候,根据siteId可以拿到repoUrl,和对应的位置确定是template或者page分支,然后走脚本即可。

@qicz
Copy link
Contributor Author

qicz commented Jul 7, 2021

可以加群 或者 加我QQ 经常交流哈

明天加一下吧。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants