MDL-40368 tool_capability: overall improvements made

* Can now compare multiple capabilities at the same time.
* Capability search now persists between requests.
* Upgraded to use renderers.
* Upgraded module.js to YUI shifted module.
* Converted deprecated calls.
* Converted forms to Moodleforms.
* Implemented backend functionality to overview at
  different context levels. Not possible presently as
  there are no front end hooks.
MDL-40386: Fix for updating timemodified field in book_chapters
MDL-40368 tool_capability: clean up as per notes from peer-review.

* Coding style clean up.
* SQL indentation
* Removal of non-matching capabilities when searching.
* Fixed notices/warnings when hitting enter on search.
MDL-40434 calculatedmulti multiple-response questions not randomised
MDL-38314 repository: Remove orphan repository instances
MDL-38314 repository: Delete repository instances on context deletion
MDL-38314 repository: Unit Tests for delete_all_for_context()
MDL-38314 repository: Improving performance of upgrade script
MDL-40490 - database: Fixed a check on database port options.

The addition of a port for the database means that an array
would be set regardless of whether it had any information or not.
The isset() function sees an array as being set and follows through
with the rest of the if statement concatenating a colon to the end
of the database host name and throwing a connection problem if no port
number is supplied.

The if statement has now been changed to if not empty. The empty
function does see zero as an empty value, but a port shouldn't have
a value of zero anyway.
MDL-40401 Libraries: load_temp_role() and remove_temp_roles() can not be used any more.
MDL-40402 libraries: Replace get_system_context() with context_system::instance() in core
MDL-40402 unittests: Make sure get_system_context() throws a deprecated warning
MDL-40402 libraries: Deprecate get_system_context()
MDL-40402 libraries: update the mistake in comment
MDL-40318 quiz intro comprising just an impage was not shown

Also, ensure that we don't output an empty box if there are no access
messages.
MDL-40499 Edit question from 1.9 backup breaks if images in subdirs
MDL-40500 move MOODLE_INTERNAL define before core_component include

This resolves problems with MOODLE_INTERNAL in db/subplugins.php
MDL-40415 add explicit OPcache support
MDL-37484 SCORM: disable toc in player when using direct AICC url
MDL-40243 use suspended flag in auth_enrol instead of nologin auth