ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\FileDelivery\Delivery\LegacyDelivery Class Reference
+ Inheritance diagram for ILIAS\FileDelivery\Delivery\LegacyDelivery:
+ Collaboration diagram for ILIAS\FileDelivery\Delivery\LegacyDelivery:

Public Member Functions

 attached (string $path_to_file, ?string $download_file_name=null, ?string $mime_type=null, ?bool $delete_file=false)
 
 inline (string $path_to_file, ?string $download_file_name=null, ?string $mime_type=null, ?bool $delete_file=false)
 
- Public Member Functions inherited from ILIAS\FileDelivery\Delivery\BaseDelivery
 __construct (protected GlobalHttpState $http, protected ResponseBuilder $response_builder, protected ResponseBuilder $fallback_response_builder, protected IsolationConfig $isolation=new IsolationConfig(false, null, null),)
 

Private Member Functions

 deliver (string $path_to_file, Disposition $disposition, ?string $download_file_name=null, ?string $mime_type=null, ?bool $delete_file=false)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS\FileDelivery\Delivery\BaseDelivery
 isRequestHostAllowed ()
 When user content isolation is active, only requests targeting the configured content domain may be served. More...
 
 isRequestOnContentHost ()
 Inverse of {. More...
 
 notFound (ResponseInterface $r)
 Send an empty 404 response and terminate. More...
 
 saveAndClose (ResponseInterface $r, ?string $path_to_delete=null)
 
 setGeneralHeaders (ResponseInterface $r, string $uri, string $mime_type, string $file_name, Disposition $disposition=Disposition::INLINE, bool $isolated=true)
 
 applyIsolationHeaders (ResponseInterface $r)
 When isolation is active, harden delivery responses: More...
 
- Protected Attributes inherited from ILIAS\FileDelivery\Delivery\BaseDelivery
const MIME_TYPE_MAP = __DIR__ . '/../../../FileUpload/src/mime_type_map.php'
 
array $mime_type_map
 

Detailed Description

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 28 of file LegacyDelivery.php.

Member Function Documentation

◆ attached()

ILIAS\FileDelivery\Delivery\LegacyDelivery::attached ( string  $path_to_file,
?string  $download_file_name = null,
?string  $mime_type = null,
?bool  $delete_file = false 
)

Definition at line 30 of file LegacyDelivery.php.

35 : never {
36 $this->deliver(
38 Disposition::ATTACHMENT,
42 );
43 }
deliver(string $path_to_file, Disposition $disposition, ?string $download_file_name=null, ?string $mime_type=null, ?bool $delete_file=false)

◆ deliver()

ILIAS\FileDelivery\Delivery\LegacyDelivery::deliver ( string  $path_to_file,
Disposition  $disposition,
?string  $download_file_name = null,
?string  $mime_type = null,
?bool  $delete_file = false 
)
private

Definition at line 60 of file LegacyDelivery.php.

66 : never {
67 // The content domain is reserved for signed token delivery via deliver.php.
68 // Legacy delivery must never serve files on the content host.
69 if ($this->isRequestOnContentHost()) {
70 $this->notFound($this->http->response());
71 }
72
73 // Header based delivery (X-Sendfile, X-Accel-Redirect) opens the file only after PHP has
74 // finished, when the shutdown function of saveAndClose() has already deleted it.
75 // See https://mantis.ilias.de/view.php?id=48312
76 if ($delete_file && !$this->response_builder->supportFileDeletion()) {
77 $this->response_builder = $this->fallback_response_builder;
78 }
79 $r = $this->setGeneralHeaders(
80 $this->http->response(),
82 $mime_type ?? mime_content_type($path_to_file),
85 );
86 $r = $this->response_builder->buildForStream(
87 $this->http->request(),
88 $r,
90 );
91 $this->saveAndClose($r, $delete_file ? $path_to_file : null);
92 }
saveAndClose(ResponseInterface $r, ?string $path_to_delete=null)
setGeneralHeaders(ResponseInterface $r, string $uri, string $mime_type, string $file_name, Disposition $disposition=Disposition::INLINE, bool $isolated=true)
notFound(ResponseInterface $r)
Send an empty 404 response and terminate.
static ofResource($resource)
Wraps an already created resource with the stream abstraction.
Definition: Streams.php:64
static http()
Fetches the global http state from ILIAS.

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ inline()

ILIAS\FileDelivery\Delivery\LegacyDelivery::inline ( string  $path_to_file,
?string  $download_file_name = null,
?string  $mime_type = null,
?bool  $delete_file = false 
)

Definition at line 45 of file LegacyDelivery.php.

50 : never {
51 $this->deliver(
53 Disposition::INLINE,
57 );
58 }

References ILIAS\FileDelivery\Delivery\$delete_file, ILIAS\FileDelivery\Delivery\$download_file_name, ILIAS\FileDelivery\Delivery\$mime_type, and ILIAS\FileDelivery\Delivery\deliver().

Referenced by ILIAS\Tests\FileDelivery\Delivery\LegacyDeliveryIsolationTest\deliverInline().

+ 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: