Skip to content

Commit 1382862

Browse files
committed
RestrictedFunctionsSniff - remove site_option family
1 parent 1fa0266 commit 1382862

File tree

4 files changed

+6
-27
lines changed

4 files changed

+6
-27
lines changed

WordPress-VIP-Go/ruleset.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,6 @@
279279
<rule ref="WordPressVIPMinimum.Variables.RestrictedVariables.user_meta__wpdb__usermeta">
280280
<severity>0</severity>
281281
</rule>
282-
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_delete_site_option">
283-
<severity>0</severity>
284-
</rule>
285-
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_update_site_option">
286-
<severity>0</severity>
287-
</rule>
288-
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_add_site_option">
289-
<severity>0</severity>
290-
</rule>
291282
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.get_super_admins_get_super_admins">
292283
<severity>0</severity>
293284
</rule>

WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -254,15 +254,6 @@ public function getGroups() {
254254
'lchown',
255255
],
256256
],
257-
'site_option' => [
258-
'type' => 'error',
259-
'message' => '%s() will overwrite network option values, please use the `*_option()` equivalent instead (e.g. `update_option()`).',
260-
'functions' => [
261-
'add_site_option',
262-
'update_site_option',
263-
'delete_site_option',
264-
],
265-
],
266257
'stats_get_csv' => [
267258
'type' => 'error',
268259
'message' => 'Using `%s` outside of Jetpack context pollutes the stats_cache entry in the wp_options table. We recommend building a custom function instead.',

WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.inc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,12 @@ $c->create_function = 'bar' . ( 1 === 1 ?? 'foo' ); // Ok.
215215
$wp_random_testing = create_function2( '$a, $b', 'return ( $b / $a ); '); // Ok.
216216
$wp_random_testing = create_function3( '$a, $b', 'return ( $b / $a ); '); // Ok.
217217

218-
add_site_option( $foo, 'bar' ); // Warning.
219-
add_option( $foo, 'bar' ); // Ok.
220-
update_site_option( $bar, 'foo' ); // Warning.
221-
update_option( 'foo', $bar ); // Ok.
222-
delete_site_option( $foo ); // Warning.
223-
delete_option( $bar ); // Ok.
218+
219+
220+
221+
222+
223+
224224

225225
wpcom_vip_get_page_by_path(); // Ok - VIP recommended version of get_page_by_path().
226226
get_page_by_path( $page_path ); // Warning.

WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ public function getErrorList() {
109109
198 => 1,
110110
199 => 1,
111111
200 => 1,
112-
218 => 1,
113-
220 => 1,
114-
222 => 1,
115112
228 => 1,
116113
];
117114
}

0 commit comments

Comments
 (0)