MDL-44723 Modinfo: Allow property access without magic function

While obtaining dynamic data for modinfo, it is not possible to
access even basic properties of cm_info (specifically, name)
because strange PHP behaviour prevents recursive calls to magic
properties. As a result of this, the code will fail if the first
thing you do that requires dynamic data in modinfo is an access
to ->name, but will succeed if the first thing is an access to
anything else. This can cause it to fail on random pages.

This commit adds a new API function that lets you access the
property in exactly the same way as the magic function. Because
it is not a magic function, recursive calls now work in the
expected manner.
MDL-44070 Conditional availability enhancements (1): availability fields

Adds a new field 'availability' to the course_modules and
course_sections tables. This will be used to store JSON format
data about a tree of availability restrictions.

Includes changes to modinfolib so that the new fields are available,
and to the editing forms so that they can be entered and modified.
There are unit tests for the back-end (modinfolib).
MDL-44070 Conditional availability enhancements (2): subsystem, API

This commit defines the new /availability root folder, with
/availability/classes, /availability/tests, and
/availability/condition where the condition plugins will live.
Condition plugin prefix is availability_, e.g. availability_date.

Rationale for this organisation:

1. I was originally going to put this in /lib/availability but
   it has been pointed out that putting even more junk in lib
   is probably bad.
2. 'availability' and 'condition' are the two names used in code
   to refer to this system ($CFG->enableavailability).
3. The prefix has to be short enough to allow database tables
   (although in practice I assume that condition plugins will not
   normally contain database tables).

The new API includes a Boolean tree structure that controls the
availability of an item.

AMOS BEGIN
 CPY [availabilityconditions,core_condition],[restrictaccess,core_availability]
 CPY [enableavailability,core_condition],[enableavailability,core_availability]
 CPY [configenableavailability,core_condition],[enableavailability_desc,core_availability]
AMOS END
MDL-44070 Conditional availability enhancements (3): conditions

Includes all the conditions that were in previous Moodle versions:

* Date
* Grade
* Completion (of another activity)
* User profile field

Also includes conditions that are used to reimplement
groupmembersonly:

* Grouping
* Group

For each condition, the component plus unit tests are included.

PLEASE NOTE: The code to actually check each condition is reused
from previous Moodle versions and has not been modified except to
pass codechecker. This is intentional, to reduce the risk of the
change and maximise the chance that behaviour is preserved. Some
of this code might not be very good and might need updating but
that can happen separately.
MDL-44070 Conditional availability enhancements (4): backup

Implements backup and restore for the new conditional availability
data. This includes:

* Backup and restore of new field.
* Restore updates IDs in conditions, as required.
* Restore converts availability data from legacy (Moodle 2.6) backups.
* Unit tests for all this.
MDL-44070 Conditional availability enhancements (5): DB upgrade

Converts existing data to new system as part of upgrade, including
a progress bar.

Deletes the database tables and fields that were used by the old
system and are no longer needed.
MDL-44070 Conditional availability enhancements (6): deprecate old lib

The old conditionlib.php, which is replaced by the new availability
API, has been deprecated.

* Code which uses the key functions (is_available,
  get_full_information) should still work. These now show
  deprecated warnings and then pass through to equivalents in the
  new API.
* I have created new unit tests for these functions.
* The old language file has been removed (reused strings hopefully
  moved with AMOS).
* Most other functions throw exceptions because it was impossible
  (due to fundamental API differences) or difficult to reimplement.
* I don't really expect that non-core code (outside unit tests) will
  have used any of the other functions.
MDL-44070 Conditional availability enhancements (7): link to core

Changes core code to use new API instead of the old one when
checking user access to activities and sections.
MDL-44070 Conditional avilability enhancements (8): lib changes

Changes to other libraries that are necessary after adding the
availability system and removing old conditional tables etc.
MDL-44070 Conditional avilability enhancements (9): wider changes

Changes to arbitrary areas of code that are necessary after the new
API (mostly to replace deprecated function calls).
Front-end work
Front-end work (autobuilt files)