Closed rschrenk closed 3 years ago
Hallo,
we figure out, that this problem is due to the fact, that we have the temp-directory on several machines locally. The "temp"-Directory should only be used for temporary files. In case of your plugin, you store the backups persistently.
Therefore I would suggest, that you implement the following:
Kind regards
The Kickstart templates are associated with an mbz backup file stored in the Moodle file system: https://github.com/stefanscholz/moodle-format_kickstart/blob/master/template.php#L64
The import process uses the standard Moodle API. During import, the mbz is extracted to temp storage: https://github.com/stefanscholz/moodle-format_kickstart/blob/a43c0a8e34ff075b5da673d8b7b28a477debe31c/classes/course_importer.php#L69
I don't see anything being persistently stored in temp. Can you clarify what is stored in temp that shouldn't be?
Thank you for your answer. That is weird. In our temp/backup-Directory there is one subfolder for each of our kickstart-templates, that contains the extracted course archive. If this folder is missing, we get the above mentioned error.
Is the mbz always extraced to the same subfolder?
I suffered from the same error on our test system too. There is only one webnode, so this cannot be the cause of the issue.
After this error appeared, I removed all contents of the moodledata/temp/backup folder. I started the import.php again, and the mbz actually gets extracted to moodledata/temp/backup/template1. All contents are there.
Nevertheless, the error appears.
Fehler: Call to a member function get_setting() on null
Here is the stack trace.
Stack trace:
line 106 of /course/format/kickstart/classes/course_importer.php: Error thrown
line 71 of /course/format/kickstart/classes/course_importer.php: call to format_kickstart\course_importer::import()
line 40 of /course/format/kickstart/import.php: call to format_kickstart\course_importer::import_from_template()
We moved our $CFG->tempdir to an alternative location, maybe the problem is, because you have hardcoded it to a subdir in the moodle data dir?
$filepath = $CFG->dataroot . '/temp/backup/template' . $templateid;
If you export it to the dir in the moodle dataroot, but Moodle wants to restore from the alternative location, this will not work.
Hi, yes please use that instead: make_backup_temp_directory
When importing a course I get the Error "Call to a member function get_setting() on null". This occurs in File classes/course_importer.php on line 105 with the call
$setting = $rc->get_plan()->get_setting($settingname);
Our installed plugin version is: format_kickstart 2020061300 local_kickstart_pro 2020061700
This suddenly occured and we have no clue why. Can you help us?