ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Setup\Artifact\BuildArtifactObjective Class Reference

This is an objective to build some artifact. More...

+ Inheritance diagram for ILIAS\Setup\Artifact\BuildArtifactObjective:
+ Collaboration diagram for ILIAS\Setup\Artifact\BuildArtifactObjective:

Public Member Functions

 getArtifactName ()
 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 ' . 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
 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)
 

Protected Attributes

const ARTIFACTS = __DIR__ . "/../../../../../artifacts"
 

Private Attributes

const COMPONENTS_DIRECTORY = "components"
 

Detailed Description

This is an objective to build some artifact.

Deprecated:
not deprecated in the true sense of the word, but we will be making major changes to the artifacts infrastructure, see for example https://github.com/ILIAS-eLearning/ILIAS/pull/7013#pullrequestreview-1869594435

therefore: if you are currently implementing it, please contact Richard Klees or Fabian Schmid

Definition at line 33 of file BuildArtifactObjective.php.

Member Function Documentation

◆ achieve()

ILIAS\Setup\Artifact\BuildArtifactObjective::achieve ( Setup\Environment  $environment)

Builds the artifact and puts it in its location.

@inheritdocs

Definition at line 123 of file BuildArtifactObjective.php.

124 {
125 $artifact = $this->buildIn($environment);
126
127 $path = $this->getPath();
128
129 $this->makeDirectoryFor($path);
130
131 file_put_contents($path, $artifact->serialize());
132
133 return $environment;
134 }
buildIn(Setup\Environment $env)
Builds an artifact in some given Environment.
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
$path
Definition: ltiservices.php:30

References $path, ILIAS\Setup\Artifact\BuildArtifactObjective\buildIn(), ILIAS\Setup\Artifact\BuildArtifactObjective\getPath(), and ILIAS\Setup\Artifact\BuildArtifactObjective\makeDirectoryFor().

+ Here is the call graph for this function:

◆ build()

◆ buildIn()

ILIAS\Setup\Artifact\BuildArtifactObjective::buildIn ( Setup\Environment  $env)

Builds an artifact in some given Environment.

Defaults to just dropping the environment and using build.

If you want to reimplement this, you most probably also want to reimplement getPreconditions to prepare the environment properly.

Definition at line 68 of file BuildArtifactObjective.php.

68 : Setup\Artifact
69 {
70 return $this->build();
71 }

References ILIAS\Setup\Artifact\BuildArtifactObjective\build().

Referenced by ILIAS\Setup\Artifact\BuildArtifactObjective\achieve().

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

◆ getArtifactName()

◆ getHash()

ILIAS\Setup\Artifact\BuildArtifactObjective::getHash ( )

Uses hashed Path.

@inheritdocs

Implements ILIAS\Setup\Objective.

Definition at line 88 of file BuildArtifactObjective.php.

88 : string
89 {
90 return hash("sha256", $this->getArtifactName());
91 }
getArtifactName()
Get the filename where the builder wants to put its artifact.

References ILIAS\Setup\Artifact\BuildArtifactObjective\getArtifactName().

+ Here is the call graph for this function:

◆ getLabel()

ILIAS\Setup\Artifact\BuildArtifactObjective::getLabel ( )

Defaults to 'Build ' .

$this->getArtifactName().' Artifact'.

@inheritdocs

Implements ILIAS\Setup\Objective.

Definition at line 98 of file BuildArtifactObjective.php.

98 : string
99 {
100 return 'Build ' . $this->getArtifactName() . ' Artifact';
101 }

References ILIAS\Setup\Artifact\BuildArtifactObjective\getArtifactName().

+ Here is the call graph for this function:

◆ getPath()

ILIAS\Setup\Artifact\BuildArtifactObjective::getPath ( )
protected

Definition at line 113 of file BuildArtifactObjective.php.

113 : string
114 {
115 return static::PATH();
116 }

Referenced by ILIAS\Setup\Artifact\BuildArtifactObjective\achieve().

+ Here is the caller graph for this function:

◆ getPreconditions()

ILIAS\Setup\Artifact\BuildArtifactObjective::getPreconditions ( Setup\Environment  $environment)

Defaults to no preconditions.

@inheritdocs

Definition at line 78 of file BuildArtifactObjective.php.

78 : array
79 {
80 return [];
81 }

◆ isApplicable()

ILIAS\Setup\Artifact\BuildArtifactObjective::isApplicable ( Setup\Environment  $environment)

Definition at line 136 of file BuildArtifactObjective.php.

136 : bool
137 {
138 return true;
139 }

◆ isNotable()

ILIAS\Setup\Artifact\BuildArtifactObjective::isNotable ( )

Defaults to 'true'.

@inheritdocs

Implements ILIAS\Setup\Objective.

Definition at line 108 of file BuildArtifactObjective.php.

108 : bool
109 {
110 return true;
111 }

◆ makeDirectoryFor()

ILIAS\Setup\Artifact\BuildArtifactObjective::makeDirectoryFor ( string  $path)
protected

Definition at line 141 of file BuildArtifactObjective.php.

141 : void
142 {
143 $dir = pathinfo($path)["dirname"];
144 if (!file_exists($dir)) {
145 if (!mkdir($dir, 0755, true) && !is_dir($dir)) {
146 throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir));
147 }
148 }
149 }

References $path.

Referenced by ILIAS\Setup\Artifact\BuildArtifactObjective\achieve().

+ Here is the caller graph for this function:

◆ PATH()

static ILIAS\Setup\Artifact\BuildArtifactObjective::PATH ( )
staticfinal
Returns
string The path where the artifact should be stored. You can use this path to require the artifact.

Definition at line 40 of file BuildArtifactObjective.php.

40 : string
41 {
42 return realpath(self::ARTIFACTS) . "/" . md5(static::class) . ".php";
43 }

Referenced by ILIAS\LegalDocuments\Internal\__construct(), ilGSProviderFactory\__construct(), InitResourceStorage\init(), ILIAS\StaticURL\Init\init(), InitCtrlService\init(), ILIAS\ILIASObject\LocalDIC\init(), ILIAS\User\LocalDIC\init(), ILIAS\FileDelivery\Setup\DeliveryMethodObjective\isApplicable(), and ILIAS\Notifications\UserSettings\PushNotification\isAvailable().

+ Here is the caller graph for this function:

Field Documentation

◆ ARTIFACTS

const ILIAS\Setup\Artifact\BuildArtifactObjective::ARTIFACTS = __DIR__ . "/../../../../../artifacts"
protected

Definition at line 35 of file BuildArtifactObjective.php.

◆ COMPONENTS_DIRECTORY

const ILIAS\Setup\Artifact\BuildArtifactObjective::COMPONENTS_DIRECTORY = "components"
private

Definition at line 45 of file BuildArtifactObjective.php.


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