ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
PushNotificationObjective Class Reference
+ Inheritance diagram for PushNotificationObjective:
+ Collaboration diagram for PushNotificationObjective:

Public Member Functions

 __construct (protected readonly array $provider, protected readonly Config $config)
 
 build ()
 Build the artifact based. More...
 
 getPreconditions (Environment $environment)
 Objectives might depend on other objectives. More...
 
 getArtifactName ()
 Get the filename where the builder wants to put its artifact. More...
 
 achieve (Environment $environment)
 Objectives can be achieved. 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from ILIAS\Setup\Artifact\BuildArtifactObjective
static PATH ()
 
- 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 30 of file PushNotificationObjective.php.

Constructor & Destructor Documentation

◆ __construct()

PushNotificationObjective::__construct ( protected readonly array  $provider,
protected readonly Config  $config 
)
Parameters
PushProviderInterface[]$provider

Definition at line 35 of file PushNotificationObjective.php.

36 {
37 }

Member Function Documentation

◆ achieve()

PushNotificationObjective::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 56 of file PushNotificationObjective.php.

57 {
58 if (!($this->config instanceof NullConfig)) {
59 $settings = $environment->getResource(Environment::RESOURCE_SETTINGS_FACTORY)->settingsFor('notifications');
60
61 $private_key_path = $this->config->getPrivateKeyPath();
62 if (file_exists($private_key_path)) {
63 $settings->set('private_key_path', $private_key_path);
64
65 $details = openssl_pkey_get_details(openssl_pkey_get_private('file://' . $private_key_path))['ec'];
66 $settings->set(
67 'application_server_key',
68 str_replace(
69 ['+', '/', '='],
70 ['-', '_', ''],
71 base64_encode(hex2bin('04') . $details['x'] . $details['y'])
72 )
73 );
74 } else {
75 throw new InvalidArgumentException('Notification key path is invalid!');
76 }
77 }
78
79 return parent::achieve($environment);
80 }
A configuration with no content.
Definition: NullConfig.php:27
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.

References ILIAS\Setup\Environment\getResource().

+ Here is the call graph for this function:

◆ build()

PushNotificationObjective::build ( )

Build the artifact based.

If you want to use the environment reimplement buildIn instead.

Reimplemented from ILIAS\Setup\Artifact\BuildArtifactObjective.

Definition at line 39 of file PushNotificationObjective.php.

39 : Artifact
40 {
41 return new ArrayArtifact(array_map(fn($p) => $p::class, $this->provider));
42 }
An array as an artifact.
An artifact is some file that is build on demand per installation and is not shipped with the ILIAS s...
Definition: Artifact.php:28

◆ getArtifactName()

PushNotificationObjective::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 51 of file PushNotificationObjective.php.

51 : string
52 {
53 return 'push_providers';
54 }

◆ getPreconditions()

PushNotificationObjective::getPreconditions ( Environment  $environment)

Objectives might depend on other objectives.

Exceptions
UnachievableExceptionif the objective is not achievable
Returns
Objective[]

Implements ILIAS\Setup\Objective.

Definition at line 44 of file PushNotificationObjective.php.


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