Skip to content

Commit 8383d16

Browse files
authored
Merge pull request #639 from Automattic/remove_site_option
RestrictedFunctionsSniff: Remove site_option family
2 parents 0d7da03 + b7bf01e commit 8383d16

File tree

6 files changed

+9
-33
lines changed

6 files changed

+9
-33
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
}

WordPressVIPMinimum/ruleset-test.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,9 @@ chown(); // Error.
390390
chmod(); // Error.
391391
lchgrp(); // Error.
392392
lchown(); // Error.
393-
add_site_option( 'foo', $bar ); // Error.
394-
update_site_option( $bar, $foo, true ); // Error.
395-
delete_site_option( $foo ); // Error.
393+
394+
395+
396396
wp_mail(); // Warning.
397397
mail(); // Warning.
398398
is_multi_author(); // Warning.

WordPressVIPMinimum/ruleset-test.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,6 @@
161161
390 => 1,
162162
391 => 1,
163163
392 => 1,
164-
393 => 1,
165-
394 => 1,
166-
395 => 1,
167164
402 => 1,
168165
415 => 1,
169166
425 => 1,

0 commit comments

Comments
 (0)