ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilCalendarZipJob Class Reference

Description of class class. More...

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

Public Member Functions

 __construct ()
 Construct. More...
 
 getInputTypes ()
 
 getOutputType ()
 
 isStateless ()
 
 run (array $input, Observer $observer)
 
 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
array returns the input array
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...
 

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 (array $values)
 
 extractType ($value)
 
- Protected Attributes inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
array $input = []
 
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 32 of file class.ilCalendarZipJob.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarZipJob::__construct ( )

Construct.

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

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

40  {
41  global $DIC;
42 
43  $this->logger = $DIC->logger()->cal();
44  }
global $DIC
Definition: shib_login.php:26
+ 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 96 of file class.ilCalendarZipJob.php.

96  : int
97  {
98  return 30;
99  }

◆ getInputTypes()

ilCalendarZipJob::getInputTypes ( )

Implements ILIAS\BackgroundTasks\Task.

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

49  : array
50  {
51  return
52  [
53  new SingleType(StringValue::class)
54  ];
55  }

◆ getOutputType()

ilCalendarZipJob::getOutputType ( )

Implements ILIAS\BackgroundTasks\Task.

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

60  : Type
61  {
62  return new SingleType(StringValue::class);
63  }

◆ isStateless()

ilCalendarZipJob::isStateless ( )

Implements ILIAS\BackgroundTasks\Task\Job.

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

68  : bool
69  {
70  return true;
71  }

◆ run()

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

Todo:
use filsystem service

Implements ILIAS\BackgroundTasks\Task\Job.

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

References ilFileUtils\delDir(), ILIAS\Repository\logger(), and ilFileUtils\zip().

77  : Value
78  {
79  $this->logger->debug('Start zipping input dir!');
80  $tmpdir = $input[0]->getValue();
81  $this->logger->debug('Zipping directory:' . $tmpdir);
82 
83  ilFileUtils::zip($tmpdir, $tmpdir . '.zip');
84 
85  // delete temp directory
86  ilFileUtils::delDir($tmpdir);
87 
88  $zip_file_name = new StringValue();
89  $zip_file_name->setValue($tmpdir . '.zip');
90  return $zip_file_name;
91  }
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static zip(string $a_dir, string $a_file, bool $compress_content=false)
+ Here is the call graph for this function:

Field Documentation

◆ $logger

ilLogger ilCalendarZipJob::$logger
private

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


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