ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSubmissionsZipJob.php
Go to the documentation of this file.
1<?php
2
25
33{
34 protected ilLogger $logger;
35
36 public function __construct()
37 {
38 $this->logger = $GLOBALS['DIC']->logger()->exc();
39 }
40
41 public function getInputTypes(): array
42 {
43 return
44 [
45 new SingleType(StringValue::class)
46 ];
47 }
48
49 public function getOutputType(): Type
50 {
51 return new SingleType(StringValue::class);
52 }
53
54 public function isStateless(): bool
55 {
56 return true;
57 }
58
63 public function run(
64 array $input,
65 Observer $observer
66 ): Value {
67 $tmpdir = $input[0]->getValue();
68
69 $this->logger->debug("Calling zip...");
70 $this->logger->debug("... dir: " . $tmpdir);
71 $this->logger->debug("... file: " . $tmpdir . '.zip');
72 ilFileUtils::zip($tmpdir, $tmpdir . '.zip');
73
74 // delete temp directory
75 $this->logger->debug("Deleting dir: " . $tmpdir);
76 ilFileUtils::delDir($tmpdir);
77
78 $this->logger->debug("Check zip file exists.");
79 if (is_file($tmpdir . '.zip')) {
80 $this->logger->debug("File ok.");
81 } else {
82 $this->logger->debug("File missing.");
83 }
84
85 $zip_file_name = new StringValue();
86 $zip_file_name->setValue($tmpdir . '.zip');
87 return $zip_file_name;
88 }
89
91 {
92 return 30;
93 }
94}
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.
Description of class class.
run(array $input, Observer $observer)
getValue()
Get the value that is displayed in the input client side.
Definition: Group.php:49
$GLOBALS["DIC"]
Definition: wac.php:54