ILIAS  release_8 Revision v8.24
ilCalendarZipJob Class Reference

Description of class class. More...

+ Inheritance diagram for ilCalendarZipJob:
+ Collaboration diagram for ilCalendarZipJob:

Public Member Functions

 __construct ()
 Construct. More...
 
 getInputTypes ()
 @inheritDoc More...
 
 getOutputType ()
 @inheritDoc More...
 
 isStateless ()
 @inheritDoc More...
 
 run (array $input, Observer $observer)
 @inheritDoc More...
 
 getExpectedTimeOfTaskInSeconds ()
 
Returns
int the amount of seconds this task usually taskes. If your task-duration scales with the the amount of data, try to set a possible high value of try to calculate it. If a task duration exceeds this value, it will be displayed as "possibly failed" to the user
More...
 
- Public Member Functions inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractJob
 getInput ()
 
Returns
Value[]
More...
 
- Public Member Functions inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
 setInput (array $values)
 
 getOutput ()
 
 getInput ()
 
 getType ()
 
 unfoldTask ()
 Unfold the task. More...
 
 getRemoveOption ()
 
Returns
Option An Option to remove the current task and do some cleanup if possible. This Option is displayed if the Bucket is completed. You do not have to provide an additional Option to remove in your UserInteraction, the remove-Option is added to the list of Options (last position)
See also
self::getAbortOption();
More...
 
 getAbortOption ()
 
Returns
Option In case a Job is failed or did not respond for some time, an Abort-Option is displayed. There is already a Standard-Abort-Option registered, you can override with your own and do some cleanup if possible.
More...
 
 getType ()
 
 getInputTypes ()
 
 getOutputType ()
 
 getOutput ()
 
 setInput (array $values)
 
 getInput ()
 
 unfoldTask ()
 
 getRemoveOption ()
 
 getAbortOption ()
 
 run (array $input, Observer $observer)
 
 isStateless ()
 
 getInput ()
 
 getExpectedTimeOfTaskInSeconds ()
 

Private Attributes

ilLogger $logger
 

Additional Inherited Members

- Data Fields inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
const MAIN_REMOVE = 'bt_main_remove'
 
const MAIN_ABORT = 'bt_main_abort'
 
- Protected Member Functions inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
 checkTypes ($values)
 
 extractType ($value)
 
- Protected Attributes inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
array $input = []
 
ILIAS BackgroundTasks Value $output
 

Detailed Description

Description of class class.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 18 of file class.ilCalendarZipJob.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarZipJob::__construct ( )

Construct.

Definition at line 25 of file class.ilCalendarZipJob.php.

26 {
27 global $DIC;
28
29 $this->logger = $DIC->logger()->cal();
30 }
global $DIC
Definition: feed.php:28

References $DIC, and ILIAS\Repository\logger().

+ Here is the call graph for this function:

Member Function Documentation

◆ getExpectedTimeOfTaskInSeconds()

ilCalendarZipJob::getExpectedTimeOfTaskInSeconds ( )

Returns
int the amount of seconds this task usually taskes. If your task-duration scales with the the amount of data, try to set a possible high value of try to calculate it. If a task duration exceeds this value, it will be displayed as "possibly failed" to the user

Implements ILIAS\BackgroundTasks\Task\Job.

Definition at line 82 of file class.ilCalendarZipJob.php.

82 : int
83 {
84 return 30;
85 }

◆ getInputTypes()

ilCalendarZipJob::getInputTypes ( )

@inheritDoc

Implements ILIAS\BackgroundTasks\Task.

Definition at line 35 of file class.ilCalendarZipJob.php.

35 : array
36 {
37 return
38 [
39 new SingleType(StringValue::class)
40 ];
41 }

◆ getOutputType()

ilCalendarZipJob::getOutputType ( )

@inheritDoc

Implements ILIAS\BackgroundTasks\Task.

Definition at line 46 of file class.ilCalendarZipJob.php.

46 : Type
47 {
48 return new SingleType(StringValue::class);
49 }

◆ isStateless()

ilCalendarZipJob::isStateless ( )

@inheritDoc

Implements ILIAS\BackgroundTasks\Task\Job.

Definition at line 54 of file class.ilCalendarZipJob.php.

54 : bool
55 {
56 return true;
57 }

◆ run()

ilCalendarZipJob::run ( array  $input,
Observer  $observer 
)

@inheritDoc

Todo:
use filsystem service

Implements ILIAS\BackgroundTasks\Task\Job.

Definition at line 63 of file class.ilCalendarZipJob.php.

63 : 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 }
static zip(string $a_dir, string $a_file, bool $compress_content=false)
zips given directory/file into given zip.file
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively

References ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask\$input, ilFileUtils\delDir(), ILIAS\Repository\logger(), and ilFileUtils\zip().

+ Here is the call graph for this function:

Field Documentation

◆ $logger

ilLogger ilCalendarZipJob::$logger
private

Definition at line 20 of file class.ilCalendarZipJob.php.


The documentation for this class was generated from the following file: