Closed mjangda closed 3 years ago
Looks like tests might need some tweaks
The test setup pain makes me think we should just fold this back into mu-plugins directly (at a later time of course).
The test setup pain makes me think we should just fold this back into mu-plugins directly (at a later time of course).
Yep, that's been a long-standing task unfortunately.
add_role can lead to front-end writes which are not ideal. It can lead to undesirable circumstances with other roles being removed if there are intermittent database issues.
We still trigger our upgrade routine on
admin_init
so new installs will still get the roles (and there's still a chance for the latter issue to trigger but the likelihood is significantly reduced).Also includes a convenience WP-CLI command to force run the upgrade routine if needed (
wp vipsupport reset-roles
)To Test
On a new install (with PR in place):
wp_user_roles
option in the db, in should not include either of thevip_support_*
roles.wp_user_roles
option should now have the roles (can also confirm withwp role list
.WP-CLI command:
wp vipsupport reset-roles
; should result in no changeswp role delete vip_support
. Runningwp role list
should showvip_support
role missing.wp vipsupport reset-roles
again. `vip_support role should be restored.