$file = $dir . '/' . $filename;
if(\OC\Files\Filesystem::is_file($file)) {
$filesize = \OC\Files\Filesystem::filesize($file);
+ $fileTime = \OC\Files\Filesystem::filemtime($file);
$fh = \OC\Files\Filesystem::fopen($file, 'r');
- $this->addFileFromStream($fh, $internalDir . $filename, $filesize);
+ $this->addFileFromStream($fh, $internalDir . $filename, $filesize, $fileTime);
fclose($fh);
}elseif(\OC\Files\Filesystem::is_dir($file)) {
$this->addDirRecursive($file, $internalDir);
* @param int $size Filesize
* @return bool $success
*/
- public function addFileFromStream($stream, $internalName, $size){
+ public function addFileFromStream($stream, $internalName, $size, $time) {
+ $options = [];
+ if ($time) {
+ $options = [
+ 'timestamp' => $time
+ ];
+ }
+
if ($this->streamerInstance instanceof ZipStreamer) {
- return $this->streamerInstance->addFileFromStream($stream, $internalName);
+ return $this->streamerInstance->addFileFromStream($stream, $internalName, $options);
} else {
- return $this->streamerInstance->addFileFromStream($stream, $internalName, $size);
+ return $this->streamerInstance->addFileFromStream($stream, $internalName, $size, $options);
}
}
$file = $dir . '/' . $file;
if (\OC\Files\Filesystem::is_file($file)) {
$fileSize = \OC\Files\Filesystem::filesize($file);
+ $fileTime = \OC\Files\Filesystem::filemtime($file);
$fh = \OC\Files\Filesystem::fopen($file, 'r');
- $streamer->addFileFromStream($fh, basename($file), $fileSize);
+ $streamer->addFileFromStream($fh, basename($file), $fileSize, $fileTime);
fclose($fh);
} elseif (\OC\Files\Filesystem::is_dir($file)) {
$streamer->addDirRecursive($file);