ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 }
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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
static zip(string $a_dir, string $a_file, bool $compress_content=false)
run(array $input, \ILIAS\BackgroundTasks\Observer $observer)
Component logger with individual log levels by component id.