ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\FileDelivery\Setup\DeliveryMethodObjective Class Reference
+ Inheritance diagram for ILIAS\FileDelivery\Setup\DeliveryMethodObjective:
+ Collaboration diagram for ILIAS\FileDelivery\Setup\DeliveryMethodObjective:

Public Member Functions

 getArtifactPath ()
 
 build ()
 
 isApplicable (Setup\Environment $environment)
 
- Public Member Functions inherited from ILIAS\Setup\Artifact\BuildArtifactObjective
 getArtifactPath ()
 Get the filename where the builder wants to put its artifact. More...
 
 build ()
 Build the artifact based. More...
 
 buildIn (Setup\Environment $env)
 Builds an artifact in some given Environment. More...
 
 getPreconditions (Setup\Environment $environment)
 Defaults to no preconditions. More...
 
 getHash ()
 Uses hashed Path. More...
 
 getLabel ()
 Defaults to "Build $this->getArtifactPath()". More...
 
 isNotable ()
 Defaults to 'true'. More...
 
 achieve (Setup\Environment $environment)
 Builds the artifact and puts it in its location. More...
 
 isApplicable (Setup\Environment $environment)
 
- Public Member Functions inherited from ILIAS\Setup\Objective
 getPreconditions (Environment $environment)
 Objectives might depend on other objectives. More...
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 Get to know whether the objective is applicable. More...
 

Data Fields

const ARTIFACT = './src/FileDelivery/artifacts/delivery_method.php'
 
const SETTINGS = 'delivery_method'
 
const XSENDFILE = 'xsendfile'
 
const XACCEL = 'xaccel'
 
const PHP = 'php'
 

Private Member Functions

 isModXSendFileLoaded ()
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS\Setup\Artifact\BuildArtifactObjective
 makeDirectoryFor (string $path)
 

Detailed Description

Member Function Documentation

◆ build()

ILIAS\FileDelivery\Setup\DeliveryMethodObjective::build ( )

Definition at line 42 of file DeliveryMethodObjective.php.

References ILIAS\FileDelivery\Setup\DeliveryMethodObjective\isModXSendFileLoaded().

42  : Setup\Artifact
43  {
44  // check if mod_xsendfile is loaded
45  if ($this->isModXSendFileLoaded()) {
46  return new Setup\Artifact\ArrayArtifact([
47  self::SETTINGS => self::XSENDFILE
48  ]);
49  }
50 
51  return new Setup\Artifact\ArrayArtifact([
52  self::SETTINGS => self::PHP
53  ]);
54  }
+ Here is the call graph for this function:

◆ getArtifactPath()

ILIAS\FileDelivery\Setup\DeliveryMethodObjective::getArtifactPath ( )

Definition at line 37 of file DeliveryMethodObjective.php.

37  : string
38  {
39  return self::ARTIFACT;
40  }

◆ isApplicable()

ILIAS\FileDelivery\Setup\DeliveryMethodObjective::isApplicable ( Setup\Environment  $environment)

Definition at line 80 of file DeliveryMethodObjective.php.

80  : bool
81  {
82  return !file_exists(self::ARTIFACT);
83  }

◆ isModXSendFileLoaded()

ILIAS\FileDelivery\Setup\DeliveryMethodObjective::isModXSendFileLoaded ( )
private

Definition at line 56 of file DeliveryMethodObjective.php.

References Vendor\Package\$e.

Referenced by ILIAS\FileDelivery\Setup\DeliveryMethodObjective\build().

56  : bool
57  {
58  if (function_exists('apache_get_modules') && in_array('mod_xsendfile', apache_get_modules(), true)) {
59  return true;
60  }
61 
62  try {
63  $command_exists = shell_exec("which apache2ctl");
64  if ($command_exists === null || empty($command_exists)) {
65  return false;
66  }
67 
68  $loaded_modules = array_map(static function ($module) {
69  return explode(" ", trim($module))[0] ?? "";
70  }, explode("\n", shell_exec("apache2ctl -M 2>/dev/null") ?? ''));
71  } catch (\Throwable $e) {
72  $loaded_modules = [];
73  }
74  if (in_array('xsendfile_module', $loaded_modules, true)) {
75  return true;
76  }
77  return false;
78  }
+ Here is the caller graph for this function:

Field Documentation

◆ ARTIFACT

const ILIAS\FileDelivery\Setup\DeliveryMethodObjective::ARTIFACT = './src/FileDelivery/artifacts/delivery_method.php'

Definition at line 31 of file DeliveryMethodObjective.php.

Referenced by ILIAS\FileDelivery\Init\init().

◆ PHP

const ILIAS\FileDelivery\Setup\DeliveryMethodObjective::PHP = 'php'

Definition at line 35 of file DeliveryMethodObjective.php.

Referenced by ILIAS\FileDelivery\Init\init().

◆ SETTINGS

const ILIAS\FileDelivery\Setup\DeliveryMethodObjective::SETTINGS = 'delivery_method'

Definition at line 32 of file DeliveryMethodObjective.php.

Referenced by ILIAS\FileDelivery\Init\init().

◆ XACCEL

const ILIAS\FileDelivery\Setup\DeliveryMethodObjective::XACCEL = 'xaccel'

Definition at line 34 of file DeliveryMethodObjective.php.

Referenced by ILIAS\FileDelivery\Init\init().

◆ XSENDFILE

const ILIAS\FileDelivery\Setup\DeliveryMethodObjective::XSENDFILE = 'xsendfile'

Definition at line 33 of file DeliveryMethodObjective.php.

Referenced by ILIAS\FileDelivery\Init\init().


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