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

生产环境更新主题没有清理掉模板缓存 #2953

Closed
ruibaby opened this issue Dec 15, 2022 · 6 comments · Fixed by #2970
Closed

生产环境更新主题没有清理掉模板缓存 #2953

ruibaby opened this issue Dec 15, 2022 · 6 comments · Fixed by #2970
Assignees
Labels
area/core Issues or PRs related to the Halo Core good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.
Milestone

Comments

@ruibaby
Copy link
Member

ruibaby commented Dec 15, 2022

是什么版本出现了此问题?

2.0.1

使用的什么数据库?

PostgreSQL

使用的哪种方式部署?

Docker Compose

在线站点地址

https://techman.run

发生了什么?

复现步骤:

  1. 任意使用一个主题安装,比如 https://github.com/halo-dev/theme-earth
  2. 手动在本地修改此主题的模板。
  3. 在后台升级主题。
  4. 观察修改的改动是否生效。

我这里是将下面的部分直接删除掉,可以看见更新之后依然存在。

image

但去服务器查看主题文件,确实是更新成功的。

image

/kind bug
/area core
/milestone 2.1.x
/priority critical-urgent

相关日志输出

No response

附加信息

No response

@f2c-ci-robot f2c-ci-robot bot added the kind/bug Categorizes issue or PR as related to a bug. label Dec 15, 2022
@f2c-ci-robot f2c-ci-robot bot added this to the 2.1.x milestone Dec 15, 2022
@f2c-ci-robot f2c-ci-robot bot added area/core Issues or PRs related to the Halo Core priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. labels Dec 15, 2022
@guqing
Copy link
Member

guqing commented Dec 15, 2022

/label good-first-issue

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 15, 2022

@guqing: The label(s) /label good-first-issue cannot be applied. These labels are supported: tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash

In response to this:

/label good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@guqing guqing added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Dec 15, 2022
@guqing
Copy link
Member

guqing commented Dec 15, 2022

更新主题之后可以通过 ThemeResolver 得到 ThemeContext 然后依赖注入 TemplateEngineManager 通过 themeContext
得到TemplateEngine,调用 clearTemplateCache 即可

@minliacom
Copy link
Contributor

我来试着修复一下吧看看能不能搞定

@guqing
Copy link
Member

guqing commented Dec 15, 2022

建议在 TemplateEngineManager 添加一个清除模板引擎缓存的方法,更新主题后调用它

@ruibaby
Copy link
Member Author

ruibaby commented Dec 15, 2022

/assign @minliacom

f2c-ci-robot bot pushed a commit that referenced this issue Dec 19, 2022
…#2970)

#### What type of PR is this?

/kind improvement

#### What this PR does / why we need it:

通过在模板引擎管理器里添加clearCache方法,在升级主题后进行缓存刷新,让新模板内容生效。

#### Which issue(s) this PR fixes:

Fixes #2953 

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

```release-note
NONE
```
@ruibaby ruibaby modified the milestones: 2.1.x, 2.1.0 Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Issues or PRs related to the Halo Core good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants