mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 01:46:45 +02:00
Merge branch 'MDL-70842_311_v3' of https://github.com/TomoTsuyuki/moodle into MOODLE_311_STABLE
This commit is contained in:
commit
a4a5863645
1 changed files with 9 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue