ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilZipJob Class Reference

Description of class class. More...

+ Inheritance diagram for ilZipJob:
+ Collaboration diagram for ilZipJob:

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
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...
 
- Public Member Functions inherited from ILIAS\BackgroundTasks\Task\Job
 run (array $input, Observer $observer)
 

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 30 of file class.ilZipJob.php.

Constructor & Destructor Documentation

◆ __construct()

ilZipJob::__construct ( )

Construct.

Definition at line 38 of file class.ilZipJob.php.

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

39  {
40  global $DIC;
41  $this->logger = $DIC->logger()->cal();
42  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ getExpectedTimeOfTaskInSeconds()

ilZipJob::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 101 of file class.ilZipJob.php.

101  : int
102  {
103  return 30;
104  }

◆ getInputTypes()

ilZipJob::getInputTypes ( )

Implements ILIAS\BackgroundTasks\Task.

Definition at line 48 of file class.ilZipJob.php.

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

◆ getOutputType()

ilZipJob::getOutputType ( )

Implements ILIAS\BackgroundTasks\Task.

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

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

◆ isStateless()

ilZipJob::isStateless ( )

Implements ILIAS\BackgroundTasks\Task\Job.

Definition at line 69 of file class.ilZipJob.php.

69  : bool
70  {
71  return true;
72  }

◆ run()

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

Todo:
use filsystem service

Definition at line 79 of file class.ilZipJob.php.

References ilFileUtils\delDir(), ILIAS\UI\Implementation\Component\Input\getValue(), ILIAS\Repository\logger(), and ilFileUtils\zip().

79  : Value
80  {
81  $this->logger->debug('Start zipping input dir!');
82  $this->logger->dump($input);
83  $tmpdir = rtrim($input[0]->getValue(), "/");
84  $this->logger->debug('Zipping directory:' . $tmpdir);
85  $zip_name = $tmpdir . '.zip';
86  ilFileUtils::zip($tmpdir, $zip_name);
87 
88  // delete temp directory
89  ilFileUtils::delDir($tmpdir);
90 
91  $zip_file_name = new StringValue();
92  $zip_file_name->setValue($zip_name);
93 
94  return $zip_file_name;
95  }
getValue()
Get the value that is displayed in the input client side.
Definition: Group.php:47
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)
zips given directory/file into given zip.file
+ Here is the call graph for this function:

Field Documentation

◆ $logger

ilLogger ilZipJob::$logger
private

Definition at line 32 of file class.ilZipJob.php.


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