ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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, \ILIAS\BackgroundTasks\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
mixed 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...
 
- Public Member Functions inherited from ILIAS\BackgroundTasks\Task\Job
 run (array $input, Observer $observer)
 

Private Attributes

 $logger = null
 

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
 $input = []
 
 $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 14 of file class.ilCalendarZipJob.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarZipJob::__construct ( )

Construct.

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

References $GLOBALS.

23  {
24  $this->logger = $GLOBALS['DIC']->logger()->cal();
25  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

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 78 of file class.ilCalendarZipJob.php.

79  {
80  return 30;
81  }

◆ getInputTypes()

ilCalendarZipJob::getInputTypes ( )

Implements ILIAS\BackgroundTasks\Task.

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

31  {
32  return
33  [
34  new SingleType(StringValue::class)
35  ];
36  }

◆ getOutputType()

ilCalendarZipJob::getOutputType ( )

Implements ILIAS\BackgroundTasks\Task.

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

42  {
43  return new SingleType(StringValue::class);
44  }

◆ isStateless()

ilCalendarZipJob::isStateless ( )

Implements ILIAS\BackgroundTasks\Task\Job.

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

50  {
51  return true;
52  }

◆ run()

ilCalendarZipJob::run ( array  $input,
\ILIAS\BackgroundTasks\Observer  $observer 
)

Todo:
use filsystem service

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

References ilUtil\delDir(), and ilUtil\zip().

59  {
60  $this->logger->debug('Start zipping input dir!');
61  $this->logger->dump($input);
62  $tmpdir = $input[0]->getValue();
63  $this->logger->debug('Zipping directory:' . $tmpdir);
64 
65  ilUtil::zip($tmpdir, $tmpdir . '.zip');
66 
67  // delete temp directory
68  ilUtil::delDir($tmpdir);
69 
70  $zip_file_name = new StringValue();
71  $zip_file_name->setValue($tmpdir . '.zip');
72  return $zip_file_name;
73  }
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

Field Documentation

◆ $logger

ilCalendarZipJob::$logger = null
private

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


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