mirror of
https://github.com/moodle/moodle.git
synced 2025-03-22 00:20:37 +01:00
MDL-70842 mod_assign: Add more cases to add file to archive
This commit is contained in:
parent
4c26696e7e
commit
9a46c4da29
@ -3654,8 +3654,15 @@ class assign {
|
||||
$zipwriter = \core_files\archive_writer::get_stream_writer($filename, \core_files\archive_writer::ZIP_WRITER);
|
||||
|
||||
// Stream the files into the zip.
|
||||
foreach ($filesforzipping as $pathinzip => $storedfile) {
|
||||
$zipwriter->add_file_from_stored_file($pathinzip, $storedfile);
|
||||
foreach ($filesforzipping as $pathinzip => $file) {
|
||||
if ($file instanceof \stored_file) {
|
||||
// Most of cases are \stored_file.
|
||||
$zipwriter->add_file_from_stored_file($pathinzip, $file);
|
||||
} else if (is_array($file)) {
|
||||
// Save $file as contents, from onlinetext subplugin.
|
||||
$content = reset($file);
|
||||
$zipwriter->add_file_from_string($pathinzip, $content);
|
||||
}
|
||||
}
|
||||
|
||||
// Finish the archive.
|
||||
|
Loading…
x
Reference in New Issue
Block a user