I just committed a change to how we populate roles during upgrade. The old way made adding new capabilities to existing roles a pain. The new way handles this nicely and is much easier on the eyes. Furthermore, it actually makes use of our role/cap API instead of going under the covers. What a concept, using our own API. 🙂
Give the changeset a look to make sure I didn’t leave out or mangle any caps.
Hmm. This turns one query via the old update_options() into around 70 distinct queries during the install. But apart from that, cool!
Yeah, but the extra queries don’t matter too much during upgrade. If they become a problem we can throttle them.
I came across a few problems – people were experiencing problems registering because add_cap() requires 2 parameters and upgrade-schema.php calls only have one. Same goes for add_role() except that requires 3..
I had an eventful morning today!
The call signatures changed to make those arguments optional. They default to true.
Somehow I missed the changes to the capabilities.php and the optional arguments change never made it over. Fixed it now! 🙂
The new code looks so clean I feel like crying. 🙂
Nicely done!!