ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilZipJob.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
7
14class ilZipJob extends AbstractJob
15{
16 private $logger = null;
17
18
22 public function __construct()
23 {
24 $this->logger = $GLOBALS['DIC']->logger()->cal();
25 }
26
27
31 public function getInputTypes()
32 {
33 return
34 [
35 new SingleType(StringValue::class),
36 ];
37 }
38
39
43 public function getOutputType()
44 {
45 return new SingleType(StringValue::class);
46 }
47
48
52 public function isStateless()
53 {
54 return true;
55 }
56
57
62 public function run(array $input, \ILIAS\BackgroundTasks\Observer $observer)
63 {
64 $this->logger->debug('Start zipping input dir!');
65 $this->logger->dump($input);
66 $tmpdir = $input[0]->getValue();
67 $this->logger->debug('Zipping directory:' . $tmpdir);
68
69 ilUtil::zip($tmpdir, $tmpdir . '.zip');
70
71 // delete temp directory
72 ilUtil::delDir($tmpdir);
73
74 $zip_file_name = new StringValue();
75 $zip_file_name->setValue($tmpdir . '.zip');
76
77 return $zip_file_name;
78 }
79
80
85 {
86 return 30;
87 }
88}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
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
Description of class class.
getOutputType()
@inheritDoc
run(array $input, \ILIAS\BackgroundTasks\Observer $observer)
@inheritDoc
getInputTypes()
@inheritDoc
isStateless()
@inheritDoc
__construct()
Construct.
getExpectedTimeOfTaskInSeconds()
int the amount of seconds this task usually taskes. If your task-duration scales with the the amount ...
Class ChatMainBarProvider \MainMenu\Provider.