ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
FileDelivery.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS;
22
44
45class FileDelivery implements Component
46{
47 public function init(
48 array|\ArrayAccess &$define,
49 array|\ArrayAccess &$implement,
50 array|\ArrayAccess &$use,
51 array|\ArrayAccess &$contribute,
52 array|\ArrayAccess &$seek,
53 array|\ArrayAccess &$provide,
54 array|\ArrayAccess &$pull,
55 array|\ArrayAccess &$internal,
56 ): void {
57 $define[] = DataSigning::class;
58 $define[] = FileDeliveryServices::class;
59
60 $contribute[Agent::class] = static fn() => new \ILIAS\FileDelivery\Setup\Agent(
61 $pull[Factory::class]
62 );
63
64 $contribute[PublicAsset::class] = fn() => new Endpoint($this, "deliver.php");
65
66 // INITIALIZATION OF SERVICES
67 // The delivery method is baked into an artefact at setup time, so the
68 // builder is picked without a DB or ini read.
69 $internal[ResponseBuilder::class] = static fn() => ResponseBuilderFactory::fromArtefact();
70
71 // Both the content domain and the ILIAS domain (derived from http_path)
72 // are baked into the artefact at setup time, so no ini read is needed.
73 $internal[IsolationConfig::class] = static fn() => IsolationConfig::fromArtefact();
74
75 $internal[PHPResponseBuilder::class] = (static fn() => new PHPResponseBuilder());
76
77 $internal[DataSigning::class] = static fn() => new DataSigner(
78 SecretKeyRotation::fromArtefact(KeyRotationObjective::PATH())
79 );
80
81 $implement[DataSigning::class] = static fn() => $internal[DataSigning::class];
82
83 $internal[StreamDelivery::class] = (static fn() => new StreamDelivery(
84 $use[DataSigning::class],
85 $use[GlobalHttpState::class],
86 $internal[ResponseBuilder::class],
87 $internal[PHPResponseBuilder::class],
88 $internal[IsolationConfig::class],
89 ));
90
91 $internal[LegacyDelivery::class] = (static fn() => new LegacyDelivery(
92 $use[GlobalHttpState::class],
93 $internal[ResponseBuilder::class],
94 $internal[PHPResponseBuilder::class],
95 $internal[IsolationConfig::class],
96 ));
97
98 $internal[FileDeliveryServices::class] = (static fn() => new Services(
99 $internal[StreamDelivery::class],
100 $internal[LegacyDelivery::class],
101 $use[DataSigning::class],
102 $use[GlobalHttpState::class],
103 $internal[IsolationConfig::class],
104 $use[HttpPathProvider::class],
105 ));
106
107 $implement[FileDeliveryServices::class] = static fn() => $internal[FileDeliveryServices::class];
108
109 $contribute[EntryPoint::class] = static fn() => new \ILIAS\FileDelivery\EntryPoint(
110 $internal[FileDeliveryServices::class],
111 $use[GlobalHttpState::class],
112 );
113
119 $internal[FilePayloadFactory::class] = static fn() => new FilePayloadFactory();
120 $provide[FilePayloadFactory::class] = static fn() => $internal[FilePayloadFactory::class];
121 }
122}
An endpoint is a PHP file that produces output via HTTP.
Definition: Endpoint.php:29
Builds data types.
Definition: Factory.php:36
Builds the payload of a delivering activity and describes its shape.
Builds the ResponseBuilder an installation is set up for.
Read-only configuration of the IRSS User Content Isolation feature.
static fromArtefact(?string $path=null)
Load the configuration from the static artefact written by the setup.
Key rotation can provide an extra layer of mitigation against an attacker discovering a secret key.
init(array|\ArrayAccess &$define, array|\ArrayAccess &$implement, array|\ArrayAccess &$use, array|\ArrayAccess &$contribute, array|\ArrayAccess &$seek, array|\ArrayAccess &$provide, array|\ArrayAccess &$pull, array|\ArrayAccess &$internal,)
An public asset is a file or folder that should be served via the web.
Definition: PublicAsset.php:27
Interface GlobalHttpState.
Tells under which URL this ILIAS installation is reached, e.g.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.