ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\COPage\Setup\EditorAssetVersionObjective Class Reference
+ Inheritance diagram for ILIAS\COPage\Setup\EditorAssetVersionObjective:
+ Collaboration diagram for ILIAS\COPage\Setup\EditorAssetVersionObjective:

Public Member Functions

 getArtifactName ()
 Get the filename where the builder wants to put its artifact. More...
 
 build ()
 Build the artifact based. More...
 
- Public Member Functions inherited from ILIAS\Setup\Artifact\BuildArtifactObjective
 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 getVersionFromSource ()
 
static getVersion ()
 
- Static Public Member Functions inherited from ILIAS\Setup\Artifact\BuildArtifactObjective
static PATH ()
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS\Setup\Artifact\BuildArtifactObjective
 getPath ()
 
 makeDirectoryFor (string $path)
 
- Protected Attributes inherited from ILIAS\Setup\Artifact\BuildArtifactObjective
const ARTIFACTS = __DIR__ . "/../../../../../artifacts"
 

Detailed Description

Definition at line 27 of file class.EditorAssetVersionObjective.php.

Member Function Documentation

◆ build()

ILIAS\COPage\Setup\EditorAssetVersionObjective::build ( )

Build the artifact based.

If you want to use the environment reimplement buildIn instead.

Reimplemented from ILIAS\Setup\Artifact\BuildArtifactObjective.

Definition at line 34 of file class.EditorAssetVersionObjective.php.

34 : Artifact
35 {
36 return new ArrayArtifact([self::getVersionFromSource()]);
37 }

◆ getArtifactName()

ILIAS\COPage\Setup\EditorAssetVersionObjective::getArtifactName ( )

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 from ILIAS\Setup\Artifact\BuildArtifactObjective.

Definition at line 29 of file class.EditorAssetVersionObjective.php.

29 : string
30 {
31 return "copage_editor_asset_version";
32 }

◆ getVersion()

static ILIAS\COPage\Setup\EditorAssetVersionObjective::getVersion ( )
static

Definition at line 66 of file class.EditorAssetVersionObjective.php.

66 : string
67 {
68 $path = self::PATH();
69 if (!is_readable($path)) {
70 throw new \RuntimeException(
71 "Missing COPage editor asset version artifact. Run setup build."
72 );
73 }
74
75 $artifact = require $path;
76 $version = is_array($artifact) ? ($artifact[0] ?? null) : null;
77 if (!is_string($version) || !preg_match('/^[a-f0-9]{16}$/', $version)) {
78 throw new \RuntimeException("Invalid COPage editor asset version artifact.");
79 }
80
81 return $version;
82 }
$version
Definition: plugin.php:24

References $version, and ILIAS\Setup\Artifact\BuildArtifactObjective\PATH().

+ Here is the call graph for this function:

◆ getVersionFromSource()

static ILIAS\COPage\Setup\EditorAssetVersionObjective::getVersionFromSource ( )
static

Definition at line 39 of file class.EditorAssetVersionObjective.php.

39 : string
40 {
41 $files = [];
42 foreach (["Editor/js", "PC/InteractiveImage/js"] as $directory) {
43 $iterator = new \RecursiveIteratorIterator(
44 new \RecursiveDirectoryIterator(
45 dirname(__DIR__, 2) . "/" . $directory,
46 \FilesystemIterator::SKIP_DOTS
47 )
48 );
49 foreach ($iterator as $file) {
50 if ($file->isFile()) {
51 $files[] = $directory . "/" . $iterator->getSubPathName();
52 }
53 }
54 }
55 sort($files, SORT_STRING);
56
57 $hash = hash_init("sha256");
58 foreach ($files as $file) {
59 hash_update($hash, $file);
60 hash_update_file($hash, dirname(__DIR__, 2) . "/" . $file);
61 }
62
63 return substr(hash_final($hash), 0, 16);
64 }

References $files, ILIAS\Scripts\PHPStan\$iterator, and ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

Referenced by ILIAS\COPage\init().

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

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