ILIAS  release_8 Revision v8.24
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

 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
 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...
 

Protected Member Functions

 makeDirectoryFor (string $path)
 

Detailed Description

This is an objective to build some artifact.

Definition at line 28 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 101 of file BuildArtifactObjective.php.

102 {
103 $artifact = $this->buildIn($environment);
104
105 // TODO: Do we want to configure this?
106 $base_path = getcwd();
107 $path = $base_path . "/" . $this->getArtifactPath();
108
109 $this->makeDirectoryFor($path);
110
111 file_put_contents($path, $artifact->serialize());
112
113 return $environment;
114 }
buildIn(Setup\Environment $env)
Builds an artifact in some given Environment.
getArtifactPath()
Get the filename where the builder wants to put its artifact.
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
$path
Definition: ltiservices.php:32

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

+ Here is the call graph for this function:

◆ build()

ILIAS\Setup\Artifact\BuildArtifactObjective::build ( )
abstract

Build the artifact based.

If you want to use the environment reimplement buildIn instead.

Reimplemented in ilCtrlBaseClassArtifactObjective, and ilCtrlStructureArtifactObjective.

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

+ Here is the caller graph for this function:

◆ 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 51 of file BuildArtifactObjective.php.

51 : Setup\Artifact
52 {
53 return $this->build();
54 }

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:

◆ getArtifactPath()

ILIAS\Setup\Artifact\BuildArtifactObjective::getArtifactPath ( )
abstract

Get the filename where the builder wants to put its artifact.

This is understood to be a path relative to the ILIAS root directory.

Reimplemented in ilCtrlBaseClassArtifactObjective, ilCtrlSecurityArtifactObjective, and ilCtrlStructureArtifactObjective.

Referenced by ILIAS\Setup\Artifact\BuildArtifactObjective\achieve(), ILIAS\Setup\Artifact\BuildArtifactObjective\getHash(), and ILIAS\Setup\Artifact\BuildArtifactObjective\getLabel().

+ Here is the caller graph for this function:

◆ getHash()

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

Uses hashed Path.

@inheritdocs

Implements ILIAS\Setup\Objective.

Definition at line 71 of file BuildArtifactObjective.php.

71 : string
72 {
73 return hash("sha256", $this->getArtifactPath());
74 }

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

+ Here is the call graph for this function:

◆ getLabel()

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

Defaults to "Build $this->getArtifactPath()".

@inheritdocs

Implements ILIAS\Setup\Objective.

Definition at line 81 of file BuildArtifactObjective.php.

81 : string
82 {
83 return 'Build ' . $this->getArtifactPath();
84 }

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

+ Here is the call graph for this function:

◆ getPreconditions()

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

Defaults to no preconditions.

@inheritdocs

Definition at line 61 of file BuildArtifactObjective.php.

61 : array
62 {
63 return [];
64 }

◆ isApplicable()

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

Definition at line 116 of file BuildArtifactObjective.php.

116 : bool
117 {
118 return true;
119 }

◆ isNotable()

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

Defaults to 'true'.

@inheritdocs

Implements ILIAS\Setup\Objective.

Definition at line 91 of file BuildArtifactObjective.php.

91 : bool
92 {
93 return true;
94 }

◆ makeDirectoryFor()

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

Definition at line 121 of file BuildArtifactObjective.php.

121 : void
122 {
123 $dir = pathinfo($path)["dirname"];
124 if (!file_exists($dir)) {
125 mkdir($dir, 0755, true);
126 }
127 }

References $path.

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

+ Here is the caller graph for this function:

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