ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSubmissionsZipJob.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
7
15{
16 private $logger = null;
17
18
22 public function __construct()
23 {
24 $this->logger = $GLOBALS['DIC']->logger()->exc();
25 }
26
30 public function getInputTypes()
31 {
32 return
33 [
34 new SingleType(StringValue::class)
35 ];
36 }
37
41 public function getOutputType()
42 {
43 return new SingleType(StringValue::class);
44 }
45
49 public function isStateless()
50 {
51 return true;
52 }
53
58 public function run(array $input, \ILIAS\BackgroundTasks\Observer $observer)
59 {
60 $tmpdir = $input[0]->getValue();
61
62 $this->logger->debug("Calling zip...");
63 $this->logger->debug("... dir: " . $tmpdir);
64 $this->logger->debug("... file: " . $tmpdir . '.zip');
65 ilUtil::zip($tmpdir, $tmpdir . '.zip');
66
67 // delete temp directory
68 $this->logger->debug("Deleting dir: " . $tmpdir);
69 ilUtil::delDir($tmpdir);
70
71 $this->logger->debug("Check zip file exists.");
72 if (is_file($tmpdir . '.zip')) {
73 $this->logger->debug("File ok.");
74 } else {
75 $this->logger->debug("File missing.");
76 }
77
78 $zip_file_name = new StringValue();
79 $zip_file_name->setValue($tmpdir . '.zip');
80 return $zip_file_name;
81 }
82
87 {
88 return 30;
89 }
90}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
Description of class class.
getExpectedTimeOfTaskInSeconds()
int the amount of seconds this task usually taskes. If your task-duration scales with the the amount ...
run(array $input, \ILIAS\BackgroundTasks\Observer $observer)
@inheritDoc
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
Class ChatMainBarProvider \MainMenu\Provider.