Skip to content

Commit

Permalink
Merge pull request #639 from Automattic/remove_site_option
Browse files Browse the repository at this point in the history
RestrictedFunctionsSniff: Remove site_option family
  • Loading branch information
rebeccahum authored Mar 28, 2021
2 parents 0d7da03 + b7bf01e commit 8383d16
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 33 deletions.
9 changes: 0 additions & 9 deletions WordPress-VIP-Go/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,6 @@
<rule ref="WordPressVIPMinimum.Variables.RestrictedVariables.user_meta__wpdb__usermeta">
<severity>0</severity>
</rule>
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_delete_site_option">
<severity>0</severity>
</rule>
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_update_site_option">
<severity>0</severity>
</rule>
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_add_site_option">
<severity>0</severity>
</rule>
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.get_super_admins_get_super_admins">
<severity>0</severity>
</rule>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,6 @@ public function getGroups() {
'lchown',
],
],
'site_option' => [
'type' => 'error',
'message' => '%s() will overwrite network option values, please use the `*_option()` equivalent instead (e.g. `update_option()`).',
'functions' => [
'add_site_option',
'update_site_option',
'delete_site_option',
],
],
'stats_get_csv' => [
'type' => 'error',
'message' => 'Using `%s` outside of Jetpack context pollutes the stats_cache entry in the wp_options table. We recommend building a custom function instead.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,12 @@ $c->create_function = 'bar' . ( 1 === 1 ?? 'foo' ); // Ok.
$wp_random_testing = create_function2( '$a, $b', 'return ( $b / $a ); '); // Ok.
$wp_random_testing = create_function3( '$a, $b', 'return ( $b / $a ); '); // Ok.

add_site_option( $foo, 'bar' ); // Warning.
add_option( $foo, 'bar' ); // Ok.
update_site_option( $bar, 'foo' ); // Warning.
update_option( 'foo', $bar ); // Ok.
delete_site_option( $foo ); // Warning.
delete_option( $bar ); // Ok.







wpcom_vip_get_page_by_path(); // Ok - VIP recommended version of get_page_by_path().
get_page_by_path( $page_path ); // Warning.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ public function getErrorList() {
198 => 1,
199 => 1,
200 => 1,
218 => 1,
220 => 1,
222 => 1,
228 => 1,
];
}
Expand Down
6 changes: 3 additions & 3 deletions WordPressVIPMinimum/ruleset-test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,9 @@ chown(); // Error.
chmod(); // Error.
lchgrp(); // Error.
lchown(); // Error.
add_site_option( 'foo', $bar ); // Error.
update_site_option( $bar, $foo, true ); // Error.
delete_site_option( $foo ); // Error.



wp_mail(); // Warning.
mail(); // Warning.
is_multi_author(); // Warning.
Expand Down
3 changes: 0 additions & 3 deletions WordPressVIPMinimum/ruleset-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@
390 => 1,
391 => 1,
392 => 1,
393 => 1,
394 => 1,
395 => 1,
402 => 1,
415 => 1,
425 => 1,
Expand Down

0 comments on commit 8383d16

Please sign in to comment.