ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MediaCast\BackgroundTasks\DownloadAllZipJob Class Reference

Zip media files. More...

+ Inheritance diagram for ILIAS\MediaCast\BackgroundTasks\DownloadAllZipJob:
+ Collaboration diagram for ILIAS\MediaCast\BackgroundTasks\DownloadAllZipJob:

Public Member Functions

 __construct ()
 
 getInputTypes ()
 
 getOutputType ()
 
 isStateless ()
 
 run (array $input, \ILIAS\BackgroundTasks\Observer $observer)
 
 getExpectedTimeOfTaskInSeconds ()
 
- 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 ()
 
- Public Member Functions inherited from ILIAS\BackgroundTasks\Task\Job
 run (array $input, Observer $observer)
 
 isStateless ()
 
 getInput ()
 
 getExpectedTimeOfTaskInSeconds ()
 

Private Attributes

ilLogger $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 (array $values)
 
 extractType ($value)
 
- Protected Attributes inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
array $input = []
 
Value $output
 

Detailed Description

Zip media files.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 29 of file DownloadAllZipJob.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MediaCast\BackgroundTasks\DownloadAllZipJob::__construct ( )

Definition at line 33 of file DownloadAllZipJob.php.

34 {
35 global $DIC;
36
37 $this->logger = $DIC->logger()->mcst();
38 }
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getExpectedTimeOfTaskInSeconds()

ILIAS\MediaCast\BackgroundTasks\DownloadAllZipJob::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 77 of file DownloadAllZipJob.php.

77 : int
78 {
79 return 30;
80 }

◆ getInputTypes()

ILIAS\MediaCast\BackgroundTasks\DownloadAllZipJob::getInputTypes ( )
Returns
Type[] A list of types that are taken as input.

Implements ILIAS\BackgroundTasks\Task.

Definition at line 40 of file DownloadAllZipJob.php.

40 : array
41 {
42 return
43 [
44 new SingleType(StringValue::class)
45 ];
46 }

◆ getOutputType()

ILIAS\MediaCast\BackgroundTasks\DownloadAllZipJob::getOutputType ( )

Implements ILIAS\BackgroundTasks\Task.

Definition at line 48 of file DownloadAllZipJob.php.

48 : SingleType
49 {
50 return new SingleType(StringValue::class);
51 }

◆ isStateless()

ILIAS\MediaCast\BackgroundTasks\DownloadAllZipJob::isStateless ( )
Returns
bool returns true iff the job's output ONLY depends on the input. Stateless task results may be cached!

Implements ILIAS\BackgroundTasks\Task\Job.

Definition at line 53 of file DownloadAllZipJob.php.

53 : bool
54 {
55 return true;
56 }

◆ run()

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

Definition at line 58 of file DownloadAllZipJob.php.

58 : StringValue
59 {
60 $tmpdir = $input[0]->getValue();
61
62 $this->logger->debug("Zip $tmpdir into " . $tmpdir . '.zip');
63
64 \ilFileUtils::zip($tmpdir, $tmpdir . '.zip');
65
66 // delete temp directory
67 \ilFileUtils::delDir($tmpdir);
68
69 $zip_file_name = new StringValue();
70 $zip_file_name->setValue($tmpdir . '.zip');
71
72 $this->logger->debug("Returning " . $tmpdir . '.zip');
73
74 return $zip_file_name;
75 }
static zip(string $a_dir, string $a_file, bool $compress_content=false)
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 ILIAS\MediaCast\BackgroundTasks\DownloadAllZipJob::$logger = null
private

Definition at line 31 of file DownloadAllZipJob.php.


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