MDL-45560 report_log: Close sessions before download only

If the session is closed too early, then preferences made in the body of
the page will not be saved to the session.
MDL-45763 question Random qtype should use '0' or '1' question text.

Some time ago, it when from using '0' for no-subcategories to blank.
Change to properly define '0' or '1', update old questions, and make
sure to fix newly restored questions.

Conflicts:
	mod/quiz/editlib.php
	question/type/random/version.php
MDL-45714 backup: Less aggressive removal of old backup dirs

The old 4 hour standard was too aggressive and can cause backup files
to be removed while they were still in use. Now the same as cron,
1 week.
MDL-42782 usability: fix for extreme course page indenting
MDL-44501 mod_data: Only attempt to export files when a file exists.

The error only occurs when portfolios are enabled and there is only one field which is
a file field.
MDL-39726 backup: Move question files by context, not one at a time

Use question category contexts to send file to the file pool in bulk.
Questions are only restored in whole category chunks, so this is safe
to do.
MDL-20154 quiz: Remove unused random questions

When a random question is removed from a quiz, and it is not
in use elsewhere, it should be deleted.

Conflicts:
	mod/quiz/editlib.php
	mod/quiz/lib.php
MDL-20154 questions: question_delete_question should not check perms

By Moodle convention, library functions should not implement permission
checks, they are to be handled by the invoking code.
MDL-44309 Administration - correcting inproperly assigned column classes in environment table
MDL-45767: Fixed DB error when returning to course from external tool

The instance ID is not always returned from the external
tool provider.
MDL-42835 mod_scorm: Close tree nodes using TreeView API
MDL-45846 Libraries Reinstate custom user agent device detection
MDL-45574 Backup progress: Can time out with large number of files

When there are many files inside a single resource, it's possible
for the backup to time out because it does not report progress
while adding entries to the backup_ids table.
MDL-44711 navigation: improved expandable course calculation
MDL-45524 navigation: fixed non-expandable node behat tests
Merge branch 'MDL-45714-26' of https://github.com/merrill-oakland/moodle into MOODLE_26_STABLE
Merge branch 'MDL-39726-26' of https://github.com/merrill-oakland/moodle into MOODLE_26_STABLE
Merge branch 'MDL-45560-26' of git://github.com/andrewnicols/moodle into MOODLE_26_STABLE
MDL-45846 Libraries custom user agent device detection unit test added
Merge branch 'wip-MDL-44501-26' of git://github.com/abgreeve/moodle into MOODLE_26_STABLE