ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective Class Reference
+ Inheritance diagram for ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective:
+ Collaboration diagram for ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective:

Public Member Functions

 getArtifactName ()
 
 build ()
 
 buildIn (Environment $env)
 
 getPreconditions (Environment $environment)
 Objectives might depend on other objectives. More...
 
 getHash ()
 Get a hash for this objective. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 Get to know whether the objective is applicable. More...
 
 getHash ()
 Get a hash for this objective. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 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...
 

Static Public Member Functions

static PATH ()
 

Protected Member Functions

 getPath ()
 
 makeDirectoryFor (string $path)
 

Static Protected Member Functions

static saveName (string $name)
 

Detailed Description

Definition at line 30 of file BuildStaticConfigStoredObjective.php.

Member Function Documentation

◆ achieve()

ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective::achieve ( Environment  $environment)

Objectives can be achieved.

They might add resources to the environment when they have been achieved.

This method needs to be idempotent for a given environment. That means: if this is executed a second time, nothing new should happen. Or the other way round: if the environment already looks like desired, the objective should not take any further actions when this is called.

Exceptions

LogicException if there are unfullfilled preconditions.

Exceptions

RuntimeException if there are missing resources.

Implements ILIAS\Setup\Objective.

Definition at line 77 of file BuildStaticConfigStoredObjective.php.

77 : Environment
78 {
79 $artifact = $this->buildIn($environment);
80
81 $path = $this->getPath();
82
83 $this->makeDirectoryFor($path);
84
85 file_put_contents($path, $artifact->serialize());
86
87 return $environment;
88 }
$path
Definition: ltiservices.php:30

References $path, ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective\buildIn(), ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective\getPath(), and ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective\makeDirectoryFor().

+ Here is the call graph for this function:

◆ build()

ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective::build ( )
abstract

◆ buildIn()

ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective::buildIn ( Environment  $env)

Reimplemented in ILIAS\FileDelivery\Setup\BaseDirObjective.

Definition at line 47 of file BuildStaticConfigStoredObjective.php.

47 : Artifact
48 {
49 return $this->build();
50 }

References ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective\build().

Referenced by ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective\achieve().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getArtifactName()

◆ getHash()

ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective::getHash ( )

Get a hash for this objective.

The hash of two objectives must be the same, if they are the same objective, with the same config on the same environment, i.e. if the one is achieved the other is achieved as well because they are the same.

Implements ILIAS\Setup\Objective.

Definition at line 57 of file BuildStaticConfigStoredObjective.php.

57 : string
58 {
59 return hash("sha256", $this->getArtifactName());
60 }

References ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective\getArtifactName().

+ Here is the call graph for this function:

◆ getLabel()

ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective::getLabel ( )

Get a label that describes this objective.

Implements ILIAS\Setup\Objective.

Definition at line 62 of file BuildStaticConfigStoredObjective.php.

62 : string
63 {
64 return 'Build ' . $this->getArtifactName() . ' Ststic Config';
65 }

References ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective\getArtifactName().

+ Here is the call graph for this function:

◆ getPath()

ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective::getPath ( )
finalprotected

Definition at line 72 of file BuildStaticConfigStoredObjective.php.

72 : string
73 {
74 return static::PATH();
75 }

Referenced by ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective\achieve().

+ Here is the caller graph for this function:

◆ getPreconditions()

ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective::getPreconditions ( Environment  $environment)

Objectives might depend on other objectives.

Exceptions
UnachievableExceptionif the objective is not achievable
Returns
Objective[]

Implements ILIAS\Setup\Objective.

Reimplemented in ILIAS\FileDelivery\Setup\BaseDirObjective.

Definition at line 52 of file BuildStaticConfigStoredObjective.php.

52 : array
53 {
54 return [];
55 }

◆ isApplicable()

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

Get to know whether the objective is applicable.

Don't change the environment or cause changes on services in the environment. Just check if this objective needs to be achieved, either currently or at all. In case of doubt whether the objective is applicable or not return true.

Implements ILIAS\Setup\Objective.

Reimplemented in ILIAS\FileDelivery\Setup\DeliveryMethodObjective.

Definition at line 90 of file BuildStaticConfigStoredObjective.php.

90 : bool
91 {
92 return true;
93 }

◆ isNotable()

ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective::isNotable ( )

Get to know if this is an interesting objective for a human.

Implements ILIAS\Setup\Objective.

Definition at line 67 of file BuildStaticConfigStoredObjective.php.

67 : bool
68 {
69 return true;
70 }

◆ makeDirectoryFor()

ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective::makeDirectoryFor ( string  $path)
protected

Definition at line 95 of file BuildStaticConfigStoredObjective.php.

95 : void
96 {
97 $dir = pathinfo($path)["dirname"];
98 if (!file_exists($dir) && (!mkdir($dir, 0755, true) && !is_dir($dir))) {
99 throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir));
100 }
101 }

References $path.

Referenced by ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective\achieve().

+ Here is the caller graph for this function:

◆ PATH()

static ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective::PATH ( )
staticfinal

Definition at line 37 of file BuildStaticConfigStoredObjective.php.

37 : string
38 {
39 return realpath(__DIR__ . '/../../../../../public/data/')
40 . '/' . self::saveName((new static())->getArtifactName()) . ".php";
41 }

References ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective\getArtifactName(), and ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective\saveName().

Referenced by ILIAS\FileDelivery\Setup\BaseDirObjective\get(), and ILIAS\FileDelivery\Init\init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveName()

static ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective::saveName ( string  $name)
staticprotected

Definition at line 32 of file BuildStaticConfigStoredObjective.php.

32 : string
33 {
34 return strtolower((string) preg_replace('/[^a-zA-Z0-9_]/', '_', $name));
35 }

Referenced by ILIAS\FileDelivery\Setup\BuildStaticConfigStoredObjective\PATH().

+ Here is the caller graph for this function:

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