-
Notifications
You must be signed in to change notification settings - Fork 120
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
Disable Cache Purge on Import #347
Conversation
[v2.2.5] Bump plugin version and update readme files [Master]
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.
Some PHPCS-related fixes.
admin/class-nginx-helper-admin.php
Outdated
* @return bool | ||
*/ | ||
public function is_import_request() { | ||
$import_query_var = sanitize_text_field( $_GET['import'] ?? '' ); |
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.
-
phpcs: Generic.Formatting.MultipleStatementAlignment.NotSameWarning: Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
-
phpcs: WordPress.Security.NonceVerification.Recommended: Processing form data without nonce verification.
-
phpcs: WordPress.Security.ValidatedSanitizedInput.MissingUnslash: $_GET['import'] not unslashed before sanitization. Use wp_unslash() or similar
admin/class-nginx-helper-admin.php
Outdated
$import_query_var = sanitize_text_field( $_GET['import'] ?? '' ); | ||
$has_import_started = did_action( 'import_start' ); | ||
|
||
return (defined( 'WP_IMPORTING' ) && true === WP_IMPORTING) || 0 !== $has_import_started || ! empty( $import_query_var ); |
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.
-
phpcs: Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceAfterOpen: Expected 1 space after open parenthesis; 0 found
-
phpcs: Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceBeforeClose: Expected 1 space before close parenthesis; 0 found
admin/class-nginx-helper-admin.php
Outdated
@@ -698,7 +697,11 @@ public function update_new_blog_options( $blog_id ) { | |||
* @global object $nginx_purger | |||
*/ | |||
public function purge_all() { | |||
|
|||
|
|||
if( $this->is_import_request() ) { |
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.
phpcs: Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword: Expected 1 space after IF keyword; 0 found
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.
LGTM
Description
The aim of this PR is to disable the cache purge occurring when data is being imported in WordPress.
Type
Reference Issue
#52
Testing
The code has been tested locally and is working as expected.