MDL-42039 Restore: Prevent adding too many form fields at once

This change relates to the Moodle forms used to select activities
in the restore process.

If you add too many form fields at once, it takes a very long time
during which we can't report progress. But adding fields in smaller
groups takes longer overall, so it's a tough balance. This change
splits the adds into groups of 1,000, reporting progress between each.
MDL-42039 Restore: Add progress reporting between files in resource

When a resource contains a very large number of (presumably small)
files, we should display progress between each file so that it
doesn't time out.
MDL-42039 Restore: Add progress reporting to directory deletion

Deleting directories at the end of backup can take a long time if
there are many directories (potentially up to 65536 file
directories). This change reports progress while deleting
directories to avoid timeout.
MDL-42039 Restore: Avoid unnecessary archive file copy at start

Change the start of restore process so that the archive file can
be passed as a pathnamehash pointing to the Moodle file object,
rather than only as a filename in the temporary directory. This
avoids making an unnecessary copy of the archive file, which can
take a long time (and potentially cause a timeout) in the case
of multi-gigabyte backups.
MDL-42039 Restore: Add progress tracking while loading restore controller

In the case of a very large backup with many activities, simply loading
the restore controller (specifically, building the plan) can take a long
time and cause timeouts. This change adds progress reporting while the
restore controller is being loaded.

(This also reduces the time between first going to the page, and the
progress bar appearing, making a slightly better user experience.)
MDL-42039 Restore: Add progress tracking while creating users

When restoring a backup that contains a large number of users
to a different server where those users don't already exist,
creating users can take a significant time. This change adds
progress reporting so that it doesn't time out and shows
activity in the user interface while doing the creation.
MDL-42039 Restore: Add progress tracking while creating question files

If a backup contains a large number of questions, the
create_question_files function can take a very long time. This
change adds progress reporting during that function.