From 6fbbee2c3dbd88e00f23f2ab7710747262c09935 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 29 Apr 2022 15:34:31 +0200 Subject: [PATCH] propagate filesize change --- lib/Service/ZipService.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/Service/ZipService.php b/lib/Service/ZipService.php index 0ca1614..8ff28a0 100644 --- a/lib/Service/ZipService.php +++ b/lib/Service/ZipService.php @@ -31,6 +31,7 @@ use OC\User\NoUserException; use OCA\FilesZip\BackgroundJob\ZipJob; use OCA\FilesZip\Exceptions\TargetAlreadyExists; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; use OCP\Files\File; use OCP\Files\Folder; @@ -52,12 +53,21 @@ class ZipService { private $userSession; /** @var IJobList */ private $jobList; - - public function __construct(IRootFolder $rootFolder, NotificationService $notificationService, IUserSession $userSession, IJobList $jobList) { + /** @var ITimeFactory */ + private $timeFactory; + + public function __construct( + IRootFolder $rootFolder, + NotificationService $notificationService, + IUserSession $userSession, + IJobList $jobList, + ITimeFactory $timeFactory + ) { $this->rootFolder = $rootFolder; $this->notificationService = $notificationService; $this->userSession = $userSession; $this->jobList = $jobList; + $this->timeFactory = $timeFactory; } public function createZipJob(array $fileIds, string $target): void { @@ -97,6 +107,7 @@ public function zip(string $uid, array $fileIds, string $target): File { $countStream = CountWrapper::wrap($outStream, function ($readSize, $writtenSize) use ($targetNode) { $targetNode->getStorage()->getCache()->update($targetNode->getId(), ['size' => $writtenSize]); + $targetNode->getStorage()->getPropagator()->propagateChange($targetNode->getInternalPath(), $this->timeFactory->getTime(), $writtenSize); }); $zip = new ZipStreamer([