ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilCalendarZipJob.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
6 
13 
19 {
20  private ilLogger $logger;
21 
25  public function __construct()
26  {
27  global $DIC;
28 
29  $this->logger = $DIC->logger()->cal();
30  }
31 
35  public function getInputTypes(): array
36  {
37  return
38  [
39  new SingleType(StringValue::class)
40  ];
41  }
42 
46  public function getOutputType(): Type
47  {
48  return new SingleType(StringValue::class);
49  }
50 
54  public function isStateless(): bool
55  {
56  return true;
57  }
58 
63  public function run(array $input, Observer $observer): Value
64  {
65  $this->logger->debug('Start zipping input dir!');
66  $tmpdir = $input[0]->getValue();
67  $this->logger->debug('Zipping directory:' . $tmpdir);
68 
69  ilFileUtils::zip($tmpdir, $tmpdir . '.zip');
70 
71  // delete temp directory
72  ilFileUtils::delDir($tmpdir);
73 
74  $zip_file_name = new StringValue();
75  $zip_file_name->setValue($tmpdir . '.zip');
76  return $zip_file_name;
77  }
78 
83  {
84  return 30;
85  }
86 }
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:25
Description of class class.
static zip(string $a_dir, string $a_file, bool $compress_content=false)
run(array $input, Observer $observer)