Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/BackgroundJob/ZipJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use OCA\FilesZip\Service\ZipService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\QueuedJob;
use OCP\ITempManager;
use Psr\Log\LoggerInterface;

class ZipJob extends QueuedJob {
Expand All @@ -40,12 +41,15 @@ class ZipJob extends QueuedJob {
private $notificationService;
/** @var LoggerInterface */
private $logger;
/** @var ITempManager */
private $tempManager;

public function __construct(ITimeFactory $timeFactory, ZipService $zipService, NotificationService $notificationService, LoggerInterface $logger) {
public function __construct(ITimeFactory $timeFactory, ZipService $zipService, NotificationService $notificationService, LoggerInterface $logger, ITempManager $tempManager) {
parent::__construct($timeFactory);
$this->zipService = $zipService;
$this->notificationService = $notificationService;
$this->logger = $logger;
$this->tempManager = $tempManager;
}

public function getUid(): string {
Expand All @@ -67,6 +71,8 @@ protected function run($argument) {
} catch (\Throwable $e) {
$this->logger->error('Failed to create zip archive', ['exception' => $e]);
$this->notificationService->sendNotificationOnFailure($this);
} finally {
$this->tempManager->clean();
}
}
}