ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilCalendarZipJob.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
27 
33 {
34  private ilLogger $logger;
35 
39  public function __construct()
40  {
41  global $DIC;
42 
43  $this->logger = $DIC->logger()->cal();
44  }
45 
49  public function getInputTypes(): array
50  {
51  return
52  [
53  new SingleType(StringValue::class)
54  ];
55  }
56 
60  public function getOutputType(): Type
61  {
62  return new SingleType(StringValue::class);
63  }
64 
68  public function isStateless(): bool
69  {
70  return true;
71  }
72 
77  public function run(array $input, Observer $observer): Value
78  {
79  $this->logger->debug('Start zipping input dir!');
80  $tmpdir = $input[0]->getValue();
81  $this->logger->debug('Zipping directory:' . $tmpdir);
82 
83  ilFileUtils::zip($tmpdir, $tmpdir . '.zip');
84 
85  // delete temp directory
86  ilFileUtils::delDir($tmpdir);
87 
88  $zip_file_name = new StringValue();
89  $zip_file_name->setValue($tmpdir . '.zip');
90  return $zip_file_name;
91  }
92 
97  {
98  return 30;
99  }
100 }
getExpectedTimeOfTaskInSeconds()
int the amount of seconds this task usually taskes. If your task-duration scales with the the amount ...
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
global $DIC
Definition: shib_login.php:22
Description of class class.
static zip(string $a_dir, string $a_file, bool $compress_content=false)
run(array $input, Observer $observer)