MDL-44070 Conditional availability enhancements (3): API/tests

Implements the new availability/plugin API. This represents a
Boolean tree structure that controls the availability of an
item.

In this commit, the new API is not yet connected to the rest of
Moodle, so it doesn't do anything yet.
MDL-44070 Conditional availability enhancements (4): Backup support

Adds backup and restore support including unit tests. Plugins have
the ability to update necessary IDs after the restore.
MDL-44070 Conditional availability enhancements (5): date condition

Adds date condition (back-end only). Includes new component and unit
tests.
MDL-44070 Conditional availability enhancements (6): grade condition

Adds grade condition (back-end only). Includes new component and unit tests.
Grade fixup
Grade fixup
MDL-44070 Conditional availability enhancements (7): user profile condition

Adds user profile condition (back-end only). Includes new component and unit tests.
Profile fixup
MDL-44070 Conditional availability enhancements (8): completion condition

Adds activity completion condition (back-end only). Includes new component and
unit tests.
Completion fixup
MDL-44070 Conditional availability enhancements (9): grouping condition

Adds grouping condition (back-end only).
Grouping fixup
Grouping fixup
MDL-44070 Conditional availability enhancements (?): group condition

Adds group condition (back-end only).

(This is a new feature as previously you could only restrict access
on grouping. I thought it made sense to add group support especially
for the 'any group' case which is now needed when handling
groupmembersonly, on an activity without grouping.)
Group fixup
MDL-44070 Conditional availability enhancements (?): core access

Changes core code to use new API instead of the old one when
checking user access to activities and sections.
MDL-44070 Conditional availability enhancements (?): upgrade data

Upgrades existing data to new format. Includes unit test for the
function that does most of the work. Manual testing will also be
required for this point.