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

flush_rewrite_rules should be flagged #668

Closed
wants to merge 1 commit into from

Conversation

sboisvert
Copy link
Contributor

When we split these sniffs out this will only apply to wpcom VIP and not Go. We will want to sniff for it on Go but just make it a warning and make sure people aren't flushing on every page load.

When we split these sniffs out this will only apply to wpcom VIP and not Go. We will want to sniff for it on Go but just make it a warning and make sure people aren't flushing on every page load.
@jrfnl
Copy link
Member

jrfnl commented Aug 22, 2016

Just checking: what do you mean by "Go" in this context ?

make sure people aren't flushing on every page load.

As far as I can see, that would be impossible to check for via a static code parser like PHPCS.
Could be mentioned as part of the warning, but not checked for.

@westonruter
Copy link
Member

@jrfnl: https://vip.wordpress.com/documentation/vip-go/

And right, we could make flush_rewrite_rules() a hard error in WordPress-VIP (shared cloud hosting) but make it a warning on a yet-to-be-developed WordPress-VIP-Go standard.

@sboisvert
Copy link
Contributor Author

@jrfnl Yes my apologies it wasn't clear, "and make sure people aren't flushing on every page load." was more to be that on VIP Go it shouldn't be done, we can only flag it as a warning and let people know they shouldn't do it on every page load and rely on a human to make the call.

@jrfnl
Copy link
Member

jrfnl commented Aug 22, 2016

@westonruter @sboisvert Thanks for the clarification.

@jrfnl jrfnl modified the milestone: 0.11.0 Aug 29, 2016
// @link https://vip.wordpress.com/documentation/change-your-pretty-permalinks-or-add-custom-rewrite-rules/
'flush_rewrite_rules' => array(
'type' => 'warning',
'message' => '%s Using flush_rewrite_rules() is not required on WordPress.com VIP since it is done on every deploy and every theme switch. Using this will cause excessive writes to the database and slow down performance',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error outputted will be

flush_rewrite_rules Using flush_rewrite_rules() is not required on WordPress.com VIP since it is done on every deploy and every theme switch. Using this will cause excessive writes to the database and slow down performance

What about

Using %s() is not needed on WordPress.com VIP since it is done on every deploy and every theme switch. Using this will cause excessive writes to the database and slow down performance.

Make the function dynamic, instead of required use needed or necessary, add a fullstop to the end of the second sentence.

@grappler
Copy link
Member

As to VIP Go and VIP, you can easily create a custom ruleset for VIP GO where you can change the notice to a Warning and change the message. You can see how it can be done in the PR https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/633/files#diff-23b2b1d22ca2f4c52692ecf35d074f7b

@jrfnl jrfnl modified the milestones: 0.11.0, 0.12.0 Mar 9, 2017
@jrfnl jrfnl modified the milestones: Future Release, 0.12.0 Jun 29, 2017
@jrfnl
Copy link
Member

jrfnl commented Jul 6, 2018

@sboisvert @tomjn Just checking - as the VIP sniffs are going to be deprecated in WPCS, can this PR be closed ?
See #1309, #1409.

@tomjn
Copy link
Contributor

tomjn commented Jul 7, 2018

I'm in favour of closing this, but I think flush rewrite rules calls should flag as a warning for general WP usage, especially if it's possible to detect it's running on every page load. Perhaps a future sniff under a performance category?

@jrfnl
Copy link
Member

jrfnl commented Jul 7, 2018

I think flush rewrite rules calls should flag as a warning for general WP usage ....

@tomjn Maybe a new issue should be opened in which this can discussed.
Detecting whether it's run on every page load will be neigh impossible with PHPCS though. This might be something better suited to be included in the Tide project.

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.

6 participants