ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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
 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.

Definition at line 123 of file BuildArtifactObjective.php.

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

123  : Setup\Environment
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  }
$path
Definition: ltiservices.php:29
buildIn(Setup\Environment $env)
Builds an artifact in some given Environment.
+ Here is the call graph for this function:

◆ build()

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

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

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

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

68  : Setup\Artifact
69  {
70  return $this->build();
71  }
build()
Build the artifact based.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getArtifactName()

ILIAS\Setup\Artifact\BuildArtifactObjective::getArtifactName ( )
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.

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

Implements ILIAS\Setup\Objective.

Definition at line 88 of file BuildArtifactObjective.php.

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

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

◆ getLabel()

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

Defaults to 'Build ' .

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

Implements ILIAS\Setup\Objective.

Definition at line 98 of file BuildArtifactObjective.php.

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

98  : string
99  {
100  return 'Build ' . $this->getArtifactName() . ' Artifact';
101  }
getArtifactName()
Get the filename where the builder wants to put its artifact.
+ Here is the call graph for this function:

◆ getPath()

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

Definition at line 113 of file BuildArtifactObjective.php.

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

113  : string
114  {
115  return static::PATH();
116  }
+ Here is the caller graph for this function:

◆ getPreconditions()

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

Defaults to no preconditions.

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

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.

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

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  }
$path
Definition: ltiservices.php:29
+ 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.

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

40  : string
41  {
42  return realpath(self::ARTIFACTS) . "/" . md5(static::class) . ".php";
43  }
+ 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: