File tree Expand file tree Collapse file tree 5 files changed +34
-4
lines changed
Expand file tree Collapse file tree 5 files changed +34
-4
lines changed Original file line number Diff line number Diff line change 2929 "php" : " 5.6"
3030 },
3131 "process-timeout" : 7200 ,
32- "sort-packages" : true
32+ "sort-packages" : true ,
33+ "allow-plugins" : {
34+ "dealerdirect/phpcodesniffer-composer-installer" : true
35+ }
3336 },
3437 "extra" : {
3538 "branch-alias" : {
Original file line number Diff line number Diff line change @@ -33,3 +33,12 @@ Feature: Check whether a high number of plugins are activated
3333 Then STDOUT should be a table containing rows:
3434 | name | status | message |
3535 | plugin -active -count | warning | Number of active plugins (4 ) exceeds threshold (3 ). |
36+
37+ Scenario : Include network-enabled plugins in active plugin count
38+ Given a WP multisite installation
39+ And I run `wp plugin activate --network --all`
40+
41+ When I run `wp doctor check plugin-active-count`
42+ Then STDOUT should be a table containing rows:
43+ | name | status | message |
44+ | plugin -active -count | success | Number of active plugins (2 ) is less than threshold (80 ). |
Original file line number Diff line number Diff line change @@ -42,3 +42,21 @@ Feature: Check whether a high percentage of plugins are deactivated
4242 Then STDOUT should be a table containing rows:
4343 | name | status | message |
4444 | plugin -deactivated | warning | Greater than 60 percent of plugins are deactivated . |
45+
46+ Scenario : Gracefully handle no plugins installed
47+ Given a WP install
48+ And I run `wp plugin uninstall --all`
49+
50+ When I run `wp doctor check plugin-deactivated`
51+ Then STDOUT should be a table containing rows:
52+ | name | status | message |
53+ | plugin -deactivated | success | Less than 40 percent of plugins are deactivated . |
54+
55+ Scenario : Gracefully handle only network-enabled plugins installed and activated
56+ Given a WP multisite installation
57+ And I run `wp plugin activate --network --all`
58+
59+ When I run `wp doctor check plugin-deactivated`
60+ Then STDOUT should be a table containing rows:
61+ | name | status | message |
62+ | plugin -deactivated | success | Less than 40 percent of plugins are deactivated . |
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public function run() {
2121
2222 $ active = 0 ;
2323 foreach ( self ::get_plugins () as $ plugin ) {
24- if ( 'active ' === $ plugin ['status ' ] ) {
24+ if ( 'active ' === $ plugin ['status ' ] || ' active-network ' === $ plugin [ ' status ' ] ) {
2525 $ active ++;
2626 }
2727 }
Original file line number Diff line number Diff line change @@ -22,15 +22,15 @@ public function run() {
2222 $ active = 0 ;
2323 $ inactive = 0 ;
2424 foreach ( self ::get_plugins () as $ plugin ) {
25- if ( 'active ' === $ plugin ['status ' ] ) {
25+ if ( 'active ' === $ plugin ['status ' ] || ' active-network ' === $ plugin [ ' status ' ] ) {
2626 $ active ++;
2727 } elseif ( 'inactive ' === $ plugin ['status ' ] ) {
2828 $ inactive ++;
2929 }
3030 }
3131
3232 $ threshold = (int ) $ this ->threshold_percentage ;
33- if ( ( $ inactive / ( $ inactive + $ active ) ) > ( $ threshold / 100 ) ) {
33+ if ( $ inactive + $ active > 0 && ( $ inactive / ( $ inactive + $ active ) ) > ( $ threshold / 100 ) ) {
3434 $ this ->set_status ( 'warning ' );
3535 $ this ->set_message ( "Greater than {$ threshold } percent of plugins are deactivated. " );
3636 } else {
You can’t perform that action at this time.
0 commit comments