ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
DownloadAllZipJob.php
Go to the documentation of this file.
1<?php
2
20
24
30{
31 private ?\ilLogger $logger = null;
32
33 public function __construct()
34 {
35 global $DIC;
36
37 $this->logger = $DIC->logger()->mcst();
38 }
39
40 public function getInputTypes(): array
41 {
42 return
43 [
44 new SingleType(StringValue::class)
45 ];
46 }
47
48 public function getOutputType(): SingleType
49 {
50 return new SingleType(StringValue::class);
51 }
52
53 public function isStateless(): bool
54 {
55 return true;
56 }
57
58 public function run(array $input, \ILIAS\BackgroundTasks\Observer $observer): StringValue
59 {
60 $tmpdir = $input[0]->getValue();
61
62 $this->logger->debug("Zip $tmpdir into " . $tmpdir . '.zip');
63
64 \ilFileUtils::zip($tmpdir, $tmpdir . '.zip');
65
66 // delete temp directory
67 \ilFileUtils::delDir($tmpdir);
68
69 $zip_file_name = new StringValue();
70 $zip_file_name->setValue($tmpdir . '.zip');
71
72 $this->logger->debug("Returning " . $tmpdir . '.zip');
73
74 return $zip_file_name;
75 }
76
78 {
79 return 30;
80 }
81}
run(array $input, \ILIAS\BackgroundTasks\Observer $observer)
static zip(string $a_dir, string $a_file, bool $compress_content=false)
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
Component logger with individual log levels by component id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $DIC
Definition: shib_login.php:26