1) Remove any floatval() casting. They are breaking / killing
.10 versions (converting them to .1). Since Moodle 2.0 all the
backup::RELEASE have been 100% numerical values.
2) Use version_compare() always to compare backup::RELEASE values.
They are always versions and the function is aware of versions
> .9, able to clean/ignore alpha chars... and everything else.
Note that I've also changed a couple of cases in formats (topics and
weeks) that were correct, but just added the same comment and used
the same version_compare() comparison parameters style, so all uses
in core are consistent (and safe to be copied out there).
This patch adds better core support for copying courses.
There is now a simplified and dedicated UI for copying
courses. This can be accessed from the course context
menu or course management screens.
All backups are done asynchronously and there can be multiple
copies of a course in flight at once.
This lets plugins other than activity modules backup and restore
question attempt data.
The old backup_questions_activity_structure_step and
restore_questions_activity_structure_step base classes still exist
and work exactly the same way they did before (because they use the
trait) so this change is completely backwards compatible.
To make this work fully, a few other things in the code had to be tweaked:
* Adding restore path elements had to consider the possibility of grouped
parents in more places.
* I needed to add protected get_task() to the restore_plugin class.
I don't think that is a problem.
* In the restore trait, the process_question_... methods needed to be
changed to public for some reasons to do with PHP traits that I don't
fully understand. However, I don't think this change is a problem.
* The way question_usage restore got the new contextid had to be changed
(or it did not work in activity contexts), but the new code looks like
a better way to do it anyway so that is good.
Allow both UI and automated backups to be created without
including files. Instead include only file references.
This is essentially implementing "SAMESITE" to backup files
instead of only for import and export functionality.
A new backup setting to include files (defaults to yes)
has been included.
The restore process will also look for and attempt to
restore files from the trashdir as part of restoring
backups. Additionally to support this process the
ammount of time files are kept in trashdir before they
are cleaned up via cron is also adjustable via admin
setting.
When the course module cache is out of date during a gradebook re-calculcation it throws
throws exceptions because the module cannot be found. This prevents access to gradebook or
any type of grading functions until the cache is rebuilt.
When the cache still has no module record we log an error and return the course context.
This commit is part of work on Custom fields API,
to minimize commit history in moodle core the work of a team of developers was split
into several commits with different authors but the authorship of individual
lines of code may be different from the commit author.
The new setting will allow to host the temporary backup files
into a specific target directory. Defaults to '$CFG->tempdir/backup'.
Calling make_backup_temp_directory() checks that the required sub-directory
will be properly created under the new target directory.
A huge thanks goes to 'Diego del Blanco' and
'Chris Lawson' for contributing much of their
code and time to this project, and to Cengage
for sponsoring it.
Much appreciated!
Use question_get_top_category() instead of directly inserting into DB when
parent category is 0. This is to make sure we are not ending up with having
multiple top level question categories for a single context.