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

Description of class class. More...

+ Inheritance diagram for ilSubmissionsZipJob:
+ Collaboration diagram for ilSubmissionsZipJob:

Public Member Functions

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

Protected Attributes

ilLogger $logger
 
- Protected Attributes inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
array $input = []
 
ILIAS BackgroundTasks Value $output
 

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)
 

Detailed Description

Description of class class.

Author
Jesús López lopez.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

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

Constructor & Destructor Documentation

◆ __construct()

ilSubmissionsZipJob::__construct ( )

Definition at line 36 of file class.ilSubmissionsZipJob.php.

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

37  {
38  $this->logger = $GLOBALS['DIC']->logger()->exc();
39  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:

Member Function Documentation

◆ getExpectedTimeOfTaskInSeconds()

ilSubmissionsZipJob::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 90 of file class.ilSubmissionsZipJob.php.

90  : int
91  {
92  return 30;
93  }

◆ getInputTypes()

ilSubmissionsZipJob::getInputTypes ( )
Returns
Type[] A list of types that are taken as input.

Implements ILIAS\BackgroundTasks\Task.

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

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

◆ getOutputType()

ilSubmissionsZipJob::getOutputType ( )

Implements ILIAS\BackgroundTasks\Task.

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

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

◆ isStateless()

ilSubmissionsZipJob::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 54 of file class.ilSubmissionsZipJob.php.

54  : bool
55  {
56  return true;
57  }

◆ run()

ilSubmissionsZipJob::run ( array  $input,
Observer  $observer 
)
Exceptions

Implements ILIAS\BackgroundTasks\Task\Job.

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

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

66  : Value {
67  $tmpdir = $input[0]->getValue();
68 
69  $this->logger->debug("Calling zip...");
70  $this->logger->debug("... dir: " . $tmpdir);
71  $this->logger->debug("... file: " . $tmpdir . '.zip');
72  ilFileUtils::zip($tmpdir, $tmpdir . '.zip');
73 
74  // delete temp directory
75  $this->logger->debug("Deleting dir: " . $tmpdir);
76  ilFileUtils::delDir($tmpdir);
77 
78  $this->logger->debug("Check zip file exists.");
79  if (is_file($tmpdir . '.zip')) {
80  $this->logger->debug("File ok.");
81  } else {
82  $this->logger->debug("File missing.");
83  }
84 
85  $zip_file_name = new StringValue();
86  $zip_file_name->setValue($tmpdir . '.zip');
87  return $zip_file_name;
88  }
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 ilSubmissionsZipJob::$logger
protected

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


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