Skip to content

Commit ed54c4e

Browse files
authored
Merge pull request #110 from Automattic/restrict-is_multi_author-usage
Adding is_multi_author function to restricted ones.
2 parents a3c33c9 + 9e08a34 commit ed54c4e

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

WordPressVIPMinimum/Sniffs/VIP/RestrictedFunctionsSniff.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ public function getGroups() {
7777
'dbDelta',
7878
),
7979
),
80+
'is_multi_author' => array(
81+
'type' => 'warning',
82+
'message' => '%s can be very slow on large sites and likely not needed on many VIP sites since they tend to have more than one author.',
83+
'functions' => array(
84+
'is_multi_author',
85+
),
86+
),
8087
);
8188

8289
$deprecated_vip_helpers = array(

WordPressVIPMinimum/Tests/VIP/RestrictedFunctionsUnitTest.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,6 @@ wp_mail(); // Bad. Warning.
3636

3737
mail(); // Bad. Warning.
3838

39-
dbDelta();
39+
dbDelta(); // Bad. Warning.
40+
41+
is_multi_author(); // Bad. Warning.

WordPressVIPMinimum/Tests/VIP/RestrictedFunctionsUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function getWarningList() {
4545
33 => 1,
4646
35 => 1,
4747
37 => 1,
48+
41 => 1,
4849
);
4950

5051
}

ruleset_test.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,5 +169,7 @@ $hello = true === isset( $_GET['utm_medium'] ) ? true : false; // NOK. Warning 3
169169

170170
wp_safe_redirect( 'https.//vip.wordpress.com' ); // NOK. Error.
171171

172+
is_multi_author(); // NOK. Warning.
173+
172174
?>
173175

ruleset_test.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
157 => 1,
5151
166 => 1,
5252
170 => 1,
53-
172 => 1, // Error on the end of the file. When any code is added, bounce this.
53+
174 => 1, // Error on the end of the file. When any code is added, bounce this.
5454
),
5555
'warnings' => array(
5656
9 => 1,
@@ -75,6 +75,7 @@
7575
162 => 1,
7676
164 => 1,
7777
168 => 1,
78+
172 => 1,
7879
),
7980
'messages' => array(
8081
129 => array(

0 commit comments

Comments
 (0)