修复胶囊统计缓存不会随文章/友情链接变更及时刷新#1390
Open
violetaini wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1389
概述
完善
sakurairo_site_stats的缓存失效逻辑,使首页胶囊统计在友情链接、文章、评论内容发生变化后能够及时刷新。改动
本次修改位于
functions.php,围绕现有缓存清理逻辑及其add_action(...)注册位置进行调整,主要包含以下几部分:1. 友情链接相关
补充以下 hook:
added_linkedit_linkdelete_link这样在新增、编辑、删除友情链接后,会及时清理
sakurairo_site_stats,避免首页胶囊中的友链数量、随机友链继续显示旧数据。2. 文章相关
补充以下 hook:
save_postdeleted_posttrash_post用于覆盖文章保存、删除、移入回收站等会影响胶囊统计的场景。
其中:
save_post使用sakurairo_refresh_stats_on_post_action处理deleted_post、trash_post使用原本的sakurairo_refresh_stats_on_action处理3. 评论相关
继续保留评论相关缓存清理逻辑:
wp_insert_commentedit_commentdeleted_comment