Skip to content

Commit

Permalink
Merge branch 'MDL-76011-master' of https://github.com/abgreeve/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden committed Nov 10, 2022
2 parents 0b9df38 + 2b2b4e6 commit 8176a6c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion files/classes/local/archive_writer/zip_writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

use ZipStream\Option\Archive;
use ZipStream\ZipStream;
use ZipStream\Option\File as FileOptions;
use core_files\archive_writer;
use core_files\local\archive_writer\file_writer_interface as file_writer_interface;
use core_files\local\archive_writer\stream_writer_interface as stream_writer_interface;
Expand Down Expand Up @@ -110,8 +111,12 @@ public function add_file_from_stream(string $name, $stream): void {
}

public function add_file_from_stored_file(string $name, \stored_file $file): void {
$datetime = new \DateTime();
$datetime->setTimestamp($file->get_timemodified());
$fileoptions = new FileOptions();
$fileoptions->setTime($datetime);
$filehandle = $file->get_content_file_handle();
$this->archive->addFileFromStream($this->sanitise_filepath($name), $filehandle);
$this->archive->addFileFromStream($this->sanitise_filepath($name), $filehandle, $fileoptions);
fclose($filehandle);
}

Expand Down

0 comments on commit 8176a6c

Please sign in to comment.