-
Notifications
You must be signed in to change notification settings - Fork 121
Add Clear VPI #827
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
Closed
timotei-litespeed
wants to merge
4
commits into
litespeedtech:dev
from
timotei-litespeed:Purge-Add_VPI_clenaup
Closed
Add Clear VPI #827
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,15 +29,16 @@ class Purge extends Base { | |
| const TYPE_PURGE_ALL_LSCACHE = 'purge_all_lscache'; | ||
| const TYPE_PURGE_ALL_CSSJS = 'purge_all_cssjs'; | ||
| const TYPE_PURGE_ALL_LOCALRES = 'purge_all_localres'; | ||
| const TYPE_PURGE_ALL_CCSS = 'purge_all_ccss'; | ||
| const TYPE_PURGE_ALL_UCSS = 'purge_all_ucss'; | ||
| const TYPE_PURGE_ALL_LQIP = 'purge_all_lqip'; | ||
| const TYPE_PURGE_ALL_AVATAR = 'purge_all_avatar'; | ||
| const TYPE_PURGE_ALL_OBJECT = 'purge_all_object'; | ||
| const TYPE_PURGE_ALL_OPCACHE = 'purge_all_opcache'; | ||
|
|
||
| const TYPE_PURGE_FRONT = 'purge_front'; | ||
| const TYPE_PURGE_UCSS = 'purge_ucss'; | ||
| const TYPE_PURGE_ALL_CCSS = 'purge_all_ccss'; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| const TYPE_PURGE_ALL_UCSS = 'purge_all_ucss'; | ||
| const TYPE_PURGE_ALL_LQIP = 'purge_all_lqip'; | ||
| const TYPE_PURGE_ALL_VPI = 'purge_all_vpi'; | ||
| const TYPE_PURGE_ALL_AVATAR = 'purge_all_avatar'; | ||
| const TYPE_PURGE_ALL_OBJECT = 'purge_all_object'; | ||
| const TYPE_PURGE_ALL_OPCACHE = 'purge_all_opcache'; | ||
|
|
||
| const TYPE_PURGE_FRONT = 'purge_front'; | ||
| const TYPE_PURGE_UCSS = 'purge_ucss'; | ||
| const TYPE_PURGE_FRONTPAGE = 'purge_frontpage'; | ||
| const TYPE_PURGE_PAGES = 'purge_pages'; | ||
| const TYPE_PURGE_ERROR = 'purge_error'; | ||
|
|
@@ -124,6 +125,10 @@ public function handler() { | |
| $this->_purge_all_lqip(); | ||
| break; | ||
|
|
||
| case self::TYPE_PURGE_ALL_VPI: | ||
| $this->_purge_all_vpi(); | ||
| break; | ||
|
|
||
| case self::TYPE_PURGE_ALL_AVATAR: | ||
| $this->_purge_all_avatar(); | ||
| break; | ||
|
|
@@ -312,6 +317,27 @@ private function _purge_all_lqip( $silence = false ) { | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Delete all VPI data generated | ||
| * | ||
| * @since 7.1 | ||
| * @access private | ||
| */ | ||
| private function _purge_all_vpi($silence = false) | ||
| { | ||
| global $wpdb; | ||
| do_action('litespeed_purged_all_vpi'); | ||
|
|
||
| $wpdb->query("DELETE FROM `$wpdb->postmeta` WHERE meta_key = '" . $this->cls('Vpi')::POST_META . "'"); | ||
| $wpdb->query("DELETE FROM `$wpdb->postmeta` WHERE meta_key = '" . $this->cls('Vpi')::POST_META_MOBILE . "'"); | ||
| $this->cls('Placeholder')->rm_cache_folder('vpi'); | ||
|
|
||
| if (!$silence) { | ||
| $msg = __('Cleaned all VPI data.', 'litespeed-cache'); | ||
| !defined('LITESPEED_PURGE_SILENT') && Admin_Display::success($msg); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Delete all avatar images | ||
| * | ||
|
|
||
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timotei-litespeed You need to correct this kind of coding.
VPI::POST_META