VIP-Coding-Standards icon indicating copy to clipboard operation
VIP-Coding-Standards copied to clipboard

Add RestrictedCacheGroupSniff to restrict wp-memcached global cache groups

Open rebeccahum opened this issue 4 years ago • 4 comments
trafficstars

Fixes #260

rebeccahum avatar Jan 18 '21 23:01 rebeccahum

Also:

Just noticed that the list in your comment in the originating issue also includes:

{$taxonomy}_relationships
{$meta_type}_meta
{$taxonomy}_relationships

Those can be handled too (with less precision, but still), but that would require my remarks above to be addressed in full and then some special handling to be added for double quoted strings/heredocs.

jrfnl avatar Apr 14 '21 18:04 jrfnl

Oh cricky - still forgot to mention one more thing in my review: should a test for this new sniff be added to the ruleset-test.inc file ?

jrfnl avatar Apr 14 '21 19:04 jrfnl

For:

{$taxonomy}_relationships
{$meta_type}_meta

What about having a public property that users can set to potentially add custom taxonomies and meta?

Or would you rather have something less precise that just looks for the _relationships and _meta at the end with a manual inspection error message?

rebeccahum avatar May 03 '21 19:05 rebeccahum

So is this sniff only about WP Memcache ? or is the sniff really about the cache groups being used by Core, which are optimized via WP Memcache ?

This sniff is focusing on the global cache groups already used by core that wp-memcached persists — so it would seem the latter.

rebeccahum avatar Aug 05 '21 22:08 rebeccahum

@rebeccahum Maybe there's some use of PHPCSUtils (https://phpcsutils.com/phpdoc/classes/PHPCSUtils-Utils-PassedParameters.html ?) to be had here now?

GaryJones avatar Mar 07 '23 13:03 GaryJones

@GaryJones As #260 has now been closed, should this PR be closed too ?

jrfnl avatar Aug 21 '23 21:08 jrfnl