New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implements preliminary version of Moodle's backup/restore feature #41
Conversation
2e0dc36
to
695fe33
Compare
|
||
// This regex already matches all jpg files in such way: | ||
$search = "/\"path\":\"images\/([^\"]+)\",\"mime\"/"; | ||
$content = preg_replace($search, '@@PLUGINFILE@@/${1}","mime"', $content); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I tried replacing this:
"path":"images/imageSlideBackground-56c5a34e5743e.jpg"
with this:
"path":"@@PLUGINFILE@@/imageSlideBackground-56c5a34e5743e.jpg"
but it has no effect on the backup. There's either something I'm missing, or I just don't really understand how the backup feature is supposed to include the files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've most likely misunderstood this part. Apparently the backup feature does not check existence of files in the text fields, but instead fetches them from the mdl_files
table directly.
I've also asked help from the Moodle community: https://moodle.org/mod/forum/discuss.php?d=334643 |
I have today:
So I think it is fine to merge this, and get back to finishing the missing parts later. |
* @subpackage backup-moodle2 | ||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} | ||
* @package mod_hvp | ||
* @copyright 2016 Mediamaisteri Oy {@link http://www.mediamaisteri.com} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not an OS lawyer, so I'm not completely sure who should be mentioned on this line. :P Perhaps there should be at least a mention of the original author? Or perhaps this isn't really a problem in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would depend on how "original" it is. This seems to have been lifted from the choice module for the purpose of bootstrapping the back up library, but only from the perspective of being a template / saving typing, and not to build on top of the choice module, so you could view it as being "original".
However since you're commit history actually shows you started from the choice module, it could be viewed as a derivative work, so you may wish to reference the original authors (even if the file is now 99% different!).
Next time type it all from scratch and it's "yours" :-)
'timemodified', | ||
)); | ||
|
||
$hvp_libraries = new backup_nested_element('libraries'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix indentation
The previously indented lines have now been aligned. |
b741238
to
61e53ec
Compare
61e53ec
to
9183248
Compare
👍 |
Hi everyone. I'm keen to get a handle on where the H5P Moodle plugin is regarding backup and restore, mainly because I'm going to need it very soon. Having a look at @juho-jaakkola 's PR it seems that all of it already exists within the H5P Moodle plugin master branch, despite this PR not being merged. I can see that the backup works but attached media doesn't (I had a H5P consisting solely of a pie chart which worked fine, but a collage in which the data loaded but the images obviously failed). As my employer loves H5P and we're going to be using it a lot rather soon, I offer my services (and that of another developer @cgreenwood - we're that keen to get this working!) to get backup and restore working, if this still a community effort. |
Hm, not sure why the PR isn't merged. All the changes should be available on master. Any effort to try and fix the restore media/file issue is very welcome. I had set off some time to debug the exported files, but other issues had to come first. |
Any pointers or info you could give us to get us going in the right direction? I'm not really sure what the issues even are yet. I'm coming at this from almost no knowledge of Moodle's backup and restore code, only the knowledge that we really need it working! :) |
I'm sorry, my knowledge on the issue is quite limited as well. My guess is that there's something wrong when creating the export. |
Thanks, @icc. Do you have any pointers @juho-jaakkola ? |
Please note that @cgreenwood and I have implemented a solution and submitted a PR: #131. |
Great! I'll have a look and do some testing. |
This is already able to make a backup of the database and restore it afterwards.