Merge branch 'MDL-70842_master_v3' of https://github.com/TomoTsuyuki/moodle

This commit is contained in:
Víctor Déniz 2021-03-25 12:57:18 +00:00
commit bd926ec382

View File

@ -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.