ILIAS  release_8 Revision v8.24
ILIAS\FileDelivery\Delivery Class Reference

Class Delivery. More...

+ Collaboration diagram for ILIAS\FileDelivery\Delivery:

Public Member Functions

 __construct (string $path_to_file, Services $http)
 
 stream ()
 
 deliver ()
 
 setGeneralHeaders ()
 
 setCachingHeaders ()
 
 generateEtag ()
 
 close ()
 
 getDeliveryType ()
 
 setDeliveryType (string $delivery_type)
 
 getMimeType ()
 
 setMimeType (string $mime_type)
 
 getPathToFile ()
 
 setPathToFile (string $path_to_file)
 
 getDownloadFileName ()
 
 setDownloadFileName (string $download_file_name)
 
 getDisposition ()
 
 setDisposition (string $disposition)
 
 isSendMimeType ()
 
 setSendMimeType (bool $send_mime_type)
 
 isExitAfter ()
 
 setExitAfter (bool $exit_after)
 
 isConvertFileNameToAsci ()
 
 setConvertFileNameToAsci (bool $convert_file_name_to_asci)
 
 getEtag ()
 
 setEtag (string $etag)
 
 getShowLastModified ()
 
 setShowLastModified (bool $show_last_modified)
 
 isHasContext ()
 
 setHasContext (bool $has_context)
 
 hasCache ()
 
 setCache (bool $cache)
 
 hasHashFilename ()
 
 setHashFilename (bool $hash_filename)
 
 checkCache ()
 
 clearBuffer ()
 
 isDeleteFile ()
 
 setDeleteFile (bool $delete_file)
 

Static Public Member Functions

static isDEBUG ()
 
static setDEBUG (bool $DEBUG)
 
static returnASCIIFileName (string $original_filename)
 Converts a UTF-8 filename to ASCII. More...
 

Data Fields

const DIRECT_PHP_OUTPUT = 'php://output'
 
const DISP_ATTACHMENT = 'attachment'
 
const DISP_INLINE = 'inline'
 
const EXPIRES_IN = '+5 days'
 

Private Member Functions

 delivery ()
 
 determineMimeType ()
 
 determineDownloadFileName ()
 
 detemineDeliveryType ()
 
 sendEtagHeader ()
 
 sendLastModified ()
 
 checkExisting ()
 
 cleanDownloadFileName ()
 Converts the filename to ASCII. More...
 
 setDispositionHeaders ()
 

Private Attributes

string $delivery_type = DeliveryMethod::PHP
 
string $mime_type = ''
 
string $path_to_file = ''
 
string $download_file_name = ''
 
string $disposition = self::DISP_ATTACHMENT
 
bool $send_mime_type = true
 
bool $exit_after = true
 
bool $convert_file_name_to_asci = true
 
string $etag = ''
 
bool $show_last_modified = true
 
bool $has_context = true
 
bool $cache = false
 
bool $hash_filename = false
 
bool $delete_file = false
 
Services $http
 
FileDeliveryTypeFactory $factory
 

Static Private Attributes

static string $delivery_type_static = null
 
static bool $DEBUG = false
 

Detailed Description

Class Delivery.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
2.0.0
Since
5.3

@Internal

Definition at line 37 of file Delivery.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\FileDelivery\Delivery::__construct ( string  $path_to_file,
Services  $http 
)
Parameters
string$path_to_file
Services$http

Definition at line 67 of file Delivery.php.

68 {
69 $this->http = $http;
70 if ($path_to_file === self::DIRECT_PHP_OUTPUT) {
71 $this->setPathToFile(self::DIRECT_PHP_OUTPUT);
72 } else {
74 $this->detemineDeliveryType();
75 $this->determineMimeType();
77 }
78 $this->setHasContext(\ilContext::getType() !== null);
79 $this->factory = new FileDeliveryTypeFactory($http);
80 }
setHasContext(bool $has_context)
Definition: Delivery.php:368
setPathToFile(string $path_to_file)
Definition: Delivery.php:272
static getType()
Get context type.
static http()
Fetches the global http state from ILIAS.

References ILIAS\FileDelivery\Delivery\$http, ILIAS\FileDelivery\Delivery\detemineDeliveryType(), ILIAS\FileDelivery\Delivery\determineDownloadFileName(), ILIAS\FileDelivery\Delivery\determineMimeType(), ilContext\getType(), ILIAS\FileDelivery\http(), ILIAS\FileDelivery\Delivery\setHasContext(), and ILIAS\FileDelivery\Delivery\setPathToFile().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkCache()

ILIAS\FileDelivery\Delivery::checkCache ( )

Definition at line 431 of file Delivery.php.

431 : void
432 {
433 if ($this->hasCache()) {
434 $this->generateEtag();
435 $this->sendEtagHeader();
436 $this->setShowLastModified(true);
437 $this->setCachingHeaders();
438 }
439 }
setShowLastModified(bool $show_last_modified)
Definition: Delivery.php:356

References ILIAS\FileDelivery\Delivery\generateEtag(), ILIAS\FileDelivery\Delivery\hasCache(), ILIAS\FileDelivery\Delivery\sendEtagHeader(), ILIAS\FileDelivery\Delivery\setCachingHeaders(), and ILIAS\FileDelivery\Delivery\setShowLastModified().

Referenced by ILIAS\FileDelivery\Delivery\deliver().

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

◆ checkExisting()

ILIAS\FileDelivery\Delivery::checkExisting ( )
private

Definition at line 461 of file Delivery.php.

461 : void
462 {
463 if ($this->getPathToFile() !== self::DIRECT_PHP_OUTPUT
464 && !file_exists($this->getPathToFile())
465 ) {
466 $this->close();
467 }
468 }

References ILIAS\FileDelivery\Delivery\close(), and ILIAS\FileDelivery\Delivery\getPathToFile().

Referenced by ILIAS\FileDelivery\Delivery\setGeneralHeaders().

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

◆ cleanDownloadFileName()

ILIAS\FileDelivery\Delivery::cleanDownloadFileName ( )
private

Converts the filename to ASCII.

Definition at line 474 of file Delivery.php.

474 : void
475 {
478 }
static returnASCIIFileName(string $original_filename)
Converts a UTF-8 filename to ASCII.
Definition: Delivery.php:488
setDownloadFileName(string $download_file_name)
Definition: Delivery.php:284

References ILIAS\FileDelivery\Delivery\$download_file_name, ILIAS\FileDelivery\Delivery\getDownloadFileName(), ILIAS\FileDelivery\Delivery\returnASCIIFileName(), and ILIAS\FileDelivery\Delivery\setDownloadFileName().

Referenced by ILIAS\FileDelivery\Delivery\setGeneralHeaders().

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

◆ clearBuffer()

ILIAS\FileDelivery\Delivery::clearBuffer ( )
Returns
bool

Definition at line 445 of file Delivery.php.

445 : bool
446 {
447 try {
448 $ob_get_contents = ob_get_contents();
449 if ($ob_get_contents) {
450 // \ilWACLog::getInstance()->write(__CLASS__ . ' had output before file delivery: '
451 // . $ob_get_contents);
452 }
453 ob_end_clean(); // fixed 0016469, 0016467, 0016468
454 return true;
455 } catch (\Throwable $t) {
456 return false;
457 }
458 }

Referenced by ILIAS\FileDelivery\Delivery\deliver().

+ Here is the caller graph for this function:

◆ close()

ILIAS\FileDelivery\Delivery::close ( )

Definition at line 169 of file Delivery.php.

169 : void
170 {
171 $this->http->close();
172 }

References ILIAS\FileDelivery\http().

Referenced by ILIAS\FileDelivery\Delivery\checkExisting(), and ILIAS\FileDelivery\Delivery\deliver().

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

◆ deliver()

ILIAS\FileDelivery\Delivery::deliver ( )

Definition at line 98 of file Delivery.php.

98 : void
99 {
100 $response = $this->http->response()->withHeader('X-ILIAS-FileDelivery-Method', $this->getDeliveryType());
101 if (
102 !$this->delivery()->doesFileExists($this->path_to_file)
103 && $this->path_to_file !== self::DIRECT_PHP_OUTPUT
104 ) {
105 $response = $this->http->response()->withStatus(404);
106 $this->http->saveResponse($response);
107 $this->http->sendResponse();
108 $this->close();
109 }
110 $this->http->saveResponse($response);
111
112 $this->clearBuffer();
113 $this->checkCache();
114 $this->setGeneralHeaders();
115 $this->delivery()->prepare($this->getPathToFile());
116 $this->delivery()->deliver($this->getPathToFile(), $this->isDeleteFile());
117 if ($this->isDeleteFile()) {
118 $this->delivery()->handleFileDeletion($this->getPathToFile());
119 }
120 if ($this->isExitAfter()) {
121 $this->close();
122 }
123 }
$response

References $response, ILIAS\FileDelivery\Delivery\checkCache(), ILIAS\FileDelivery\Delivery\clearBuffer(), ILIAS\FileDelivery\Delivery\close(), ILIAS\FileDelivery\Delivery\delivery(), ILIAS\FileDelivery\Delivery\getDeliveryType(), ILIAS\FileDelivery\Delivery\getPathToFile(), ILIAS\FileDelivery\http(), ILIAS\FileDelivery\Delivery\isDeleteFile(), ILIAS\FileDelivery\Delivery\isExitAfter(), and ILIAS\FileDelivery\Delivery\setGeneralHeaders().

Referenced by ILIAS\FileDelivery\Delivery\stream().

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

◆ delivery()

ILIAS\FileDelivery\Delivery::delivery ( )
private

Definition at line 92 of file Delivery.php.

92 : ilFileDeliveryType
93 {
94 return $this->factory->getInstance($this->getDeliveryType());
95 }

References ILIAS\FileDelivery\Delivery\getDeliveryType().

Referenced by ILIAS\FileDelivery\Delivery\deliver(), and ILIAS\FileDelivery\Delivery\stream().

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

◆ detemineDeliveryType()

ILIAS\FileDelivery\Delivery::detemineDeliveryType ( )
private

@noRector

Definition at line 203 of file Delivery.php.

203 : void
204 {
205 if (self::$delivery_type_static) {
206 $this->setDeliveryType(self::$delivery_type_static);
207
208 return;
209 }
210
211 if (function_exists('apache_get_modules')
212 && in_array('mod_xsendfile', apache_get_modules(), true)
213 ) {
215 }
216
217 if (is_file('./Services/FileDelivery/classes/override.php')) {
218 $override_delivery_type = false;
220 require_once('./Services/FileDelivery/classes/override.php');
221 if ($override_delivery_type) {
222 $this->setDeliveryType($override_delivery_type);
223 }
224 }
225 $ilRuntime = \ilRuntime::getInstance();
226 if ((!$ilRuntime->isFPM() && !$ilRuntime->isHHVM())
227 && $this->getDeliveryType() === DeliveryMethod::XACCEL
228 ) {
230 }
231
233 && strpos($this->getPathToFile(), './data') !== 0
234 ) {
236 }
237
238 self::$delivery_type_static = $this->getDeliveryType();
239 }
setDeliveryType(string $delivery_type)
Definition: Delivery.php:248
static getInstance()

References ILIAS\FileDelivery\Delivery\getDeliveryType(), ilRuntime\getInstance(), ILIAS\FileDelivery\Delivery\getPathToFile(), ILIAS\FileDelivery\FileDeliveryTypes\DeliveryMethod\PHP, ILIAS\FileDelivery\Delivery\setDeliveryType(), ILIAS\FileDelivery\FileDeliveryTypes\DeliveryMethod\XACCEL, and ILIAS\FileDelivery\FileDeliveryTypes\DeliveryMethod\XSENDFILE.

Referenced by ILIAS\FileDelivery\Delivery\__construct().

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

◆ determineDownloadFileName()

ILIAS\FileDelivery\Delivery::determineDownloadFileName ( )
private

Definition at line 194 of file Delivery.php.

194 : void
195 {
196 if (!$this->getDownloadFileName()) {
197 $download_file_name = basename($this->getPathToFile());
199 }
200 }

References ILIAS\FileDelivery\Delivery\getDownloadFileName(), ILIAS\FileDelivery\Delivery\getPathToFile(), and ILIAS\FileDelivery\Delivery\setDownloadFileName().

Referenced by ILIAS\FileDelivery\Delivery\__construct().

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

◆ determineMimeType()

ILIAS\FileDelivery\Delivery::determineMimeType ( )
private

Definition at line 175 of file Delivery.php.

175 : void
176 {
177 $info = \ILIAS\FileUpload\MimeType::lookupMimeType($this->getPathToFile(), \ILIAS\FileUpload\MimeType::APPLICATION__OCTET_STREAM);
178 if ($info) {
179 $this->setMimeType($info);
180
181 return;
182 }
183 $finfo = finfo_open(FILEINFO_MIME_TYPE);
184 $info = finfo_file($finfo, $this->getPathToFile());
185 finfo_close($finfo);
186 if ($info) {
187 $this->setMimeType($info);
188
189 return;
190 }
191 }
setMimeType(string $mime_type)
Definition: Delivery.php:260
static lookupMimeType(string $path_to_file, string $fallback=self::APPLICATION__OCTET_STREAM, bool $a_external=false)
Definition: MimeType.php:542
Class ChatMainBarProvider \MainMenu\Provider.

References ILIAS\FileDelivery\Delivery\getPathToFile(), ILIAS\FileUpload\MimeType\lookupMimeType(), and ILIAS\FileDelivery\Delivery\setMimeType().

Referenced by ILIAS\FileDelivery\Delivery\__construct().

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

◆ generateEtag()

ILIAS\FileDelivery\Delivery::generateEtag ( )

Definition at line 163 of file Delivery.php.

163 : void
164 {
165 $this->setEtag(md5(filemtime($this->getPathToFile()) . filesize($this->getPathToFile())));
166 }

References ILIAS\FileDelivery\Delivery\getPathToFile(), and ILIAS\FileDelivery\Delivery\setEtag().

Referenced by ILIAS\FileDelivery\Delivery\checkCache().

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

◆ getDeliveryType()

ILIAS\FileDelivery\Delivery::getDeliveryType ( )

◆ getDisposition()

ILIAS\FileDelivery\Delivery::getDisposition ( )

Definition at line 290 of file Delivery.php.

290 : string
291 {
292 return $this->disposition;
293 }

References ILIAS\FileDelivery\Delivery\$disposition.

Referenced by ILIAS\FileDelivery\Delivery\setDispositionHeaders().

+ Here is the caller graph for this function:

◆ getDownloadFileName()

ILIAS\FileDelivery\Delivery::getDownloadFileName ( )

◆ getEtag()

ILIAS\FileDelivery\Delivery::getEtag ( )

Definition at line 338 of file Delivery.php.

338 : string
339 {
340 return $this->etag;
341 }

References ILIAS\FileDelivery\Delivery\$etag.

Referenced by ILIAS\FileDelivery\Delivery\sendEtagHeader().

+ Here is the caller graph for this function:

◆ getMimeType()

ILIAS\FileDelivery\Delivery::getMimeType ( )

Definition at line 254 of file Delivery.php.

254 : string
255 {
256 return $this->mime_type;
257 }

References ILIAS\FileDelivery\Delivery\$mime_type.

Referenced by ILIAS\FileDelivery\Delivery\setGeneralHeaders().

+ Here is the caller graph for this function:

◆ getPathToFile()

◆ getShowLastModified()

ILIAS\FileDelivery\Delivery::getShowLastModified ( )

Definition at line 350 of file Delivery.php.

350 : bool
351 {
353 }

References ILIAS\FileDelivery\Delivery\$show_last_modified.

Referenced by ILIAS\FileDelivery\Delivery\sendLastModified().

+ Here is the caller graph for this function:

◆ hasCache()

ILIAS\FileDelivery\Delivery::hasCache ( )

Definition at line 374 of file Delivery.php.

374 : bool
375 {
376 return $this->cache;
377 }

References ILIAS\FileDelivery\Delivery\$cache.

Referenced by ILIAS\FileDelivery\Delivery\checkCache().

+ Here is the caller graph for this function:

◆ hasHashFilename()

ILIAS\FileDelivery\Delivery::hasHashFilename ( )

Definition at line 386 of file Delivery.php.

386 : bool
387 {
389 }

References ILIAS\FileDelivery\Delivery\$hash_filename.

Referenced by ILIAS\FileDelivery\Delivery\setGeneralHeaders().

+ Here is the caller graph for this function:

◆ isConvertFileNameToAsci()

ILIAS\FileDelivery\Delivery::isConvertFileNameToAsci ( )

Definition at line 326 of file Delivery.php.

326 : bool
327 {
329 }

References ILIAS\FileDelivery\Delivery\$convert_file_name_to_asci.

Referenced by ILIAS\FileDelivery\Delivery\setGeneralHeaders().

+ Here is the caller graph for this function:

◆ isDEBUG()

static ILIAS\FileDelivery\Delivery::isDEBUG ( )
static

Definition at line 419 of file Delivery.php.

419 : bool
420 {
421 return self::$DEBUG;
422 }

References ILIAS\FileDelivery\Delivery\$DEBUG.

◆ isDeleteFile()

ILIAS\FileDelivery\Delivery::isDeleteFile ( )

Definition at line 517 of file Delivery.php.

517 : bool
518 {
519 return $this->delete_file;
520 }

References ILIAS\FileDelivery\Delivery\$delete_file.

Referenced by ILIAS\FileDelivery\Delivery\deliver().

+ Here is the caller graph for this function:

◆ isExitAfter()

ILIAS\FileDelivery\Delivery::isExitAfter ( )

Definition at line 314 of file Delivery.php.

314 : bool
315 {
316 return $this->exit_after;
317 }

References ILIAS\FileDelivery\Delivery\$exit_after.

Referenced by ILIAS\FileDelivery\Delivery\deliver().

+ Here is the caller graph for this function:

◆ isHasContext()

ILIAS\FileDelivery\Delivery::isHasContext ( )

Definition at line 362 of file Delivery.php.

362 : bool
363 {
364 return $this->has_context;
365 }

References ILIAS\FileDelivery\Delivery\$has_context.

◆ isSendMimeType()

ILIAS\FileDelivery\Delivery::isSendMimeType ( )

Definition at line 302 of file Delivery.php.

302 : bool
303 {
305 }

References ILIAS\FileDelivery\Delivery\$send_mime_type.

Referenced by ILIAS\FileDelivery\Delivery\setGeneralHeaders().

+ Here is the caller graph for this function:

◆ returnASCIIFileName()

static ILIAS\FileDelivery\Delivery::returnASCIIFileName ( string  $original_filename)
static

Converts a UTF-8 filename to ASCII.

Parameters
$original_filenamestring UFT8-Filename
Returns
string ASCII-Filename

Definition at line 488 of file Delivery.php.

488 : string
489 {
490 $umlaut_mapping = [
491 "Ä" => "Ae",
492 "Ö" => "Oe",
493 "Ü" => "Ue",
494 "ä" => "ae",
495 "ö" => "oe",
496 "ü" => "ue",
497 "ß" => "ss"
498 ];
499 foreach ($umlaut_mapping as $src => $tgt) {
500 $original_filename = str_replace($src, $tgt, $original_filename);
501 }
502
503 $ascii_filename = htmlentities($original_filename, ENT_NOQUOTES, 'UTF-8');
504 $ascii_filename = preg_replace('/\&(.)[^;]*;/', '\\1', $ascii_filename);
505 $ascii_filename = preg_replace('/[\x7f-\xff]/', '_', $ascii_filename);
506
507 // OS do not allow the following characters in filenames: \/:*?"<>|
508 $ascii_filename = preg_replace(
509 '/[:\x5c\/\*\?\"<>\|]/',
510 '_',
512 );
513 return $ascii_filename;
514 }
$ascii_filename
Definition: metadata.php:378

References $ascii_filename.

Referenced by ILIAS\FileDelivery\Delivery\cleanDownloadFileName().

+ Here is the caller graph for this function:

◆ sendEtagHeader()

ILIAS\FileDelivery\Delivery::sendEtagHeader ( )
private

Definition at line 398 of file Delivery.php.

398 : void
399 {
400 if ($this->getEtag()) {
401 $response = $this->http->response()->withHeader('ETag', $this->getEtag());
402 $this->http->saveResponse($response);
403 }
404 }

References $response, ILIAS\FileDelivery\Delivery\getEtag(), and ILIAS\FileDelivery\http().

Referenced by ILIAS\FileDelivery\Delivery\checkCache(), and ILIAS\FileDelivery\Delivery\setCachingHeaders().

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

◆ sendLastModified()

ILIAS\FileDelivery\Delivery::sendLastModified ( )
private

Definition at line 407 of file Delivery.php.

407 : void
408 {
409 if ($this->getShowLastModified()) {
410 $response = $this->http->response()->withHeader(
411 'Last-Modified',
412 date("D, j M Y H:i:s", filemtime($this->getPathToFile()))
413 . " GMT"
414 );
415 $this->http->saveResponse($response);
416 }
417 }

References $response, ILIAS\FileDelivery\Delivery\getPathToFile(), ILIAS\FileDelivery\Delivery\getShowLastModified(), and ILIAS\FileDelivery\http().

Referenced by ILIAS\FileDelivery\Delivery\setCachingHeaders().

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

◆ setCache()

ILIAS\FileDelivery\Delivery::setCache ( bool  $cache)

Definition at line 380 of file Delivery.php.

380 : void
381 {
382 $this->cache = $cache;
383 }

References ILIAS\FileDelivery\Delivery\$cache.

◆ setCachingHeaders()

ILIAS\FileDelivery\Delivery::setCachingHeaders ( )

Definition at line 153 of file Delivery.php.

153 : void
154 {
155 $response = $this->http->response()->withHeader(ResponseHeader::CACHE_CONTROL, 'must-revalidate, post-check=0, pre-check=0')->withHeader(ResponseHeader::PRAGMA, 'public');
156
157 $this->http->saveResponse($response->withHeader(ResponseHeader::EXPIRES, date("D, j M Y H:i:s", strtotime(self::EXPIRES_IN)) . " GMT"));
158 $this->sendEtagHeader();
159 $this->sendLastModified();
160 }

References $response, ILIAS\HTTP\Response\ResponseHeader\CACHE_CONTROL, ILIAS\HTTP\Response\ResponseHeader\EXPIRES, ILIAS\FileDelivery\http(), ILIAS\HTTP\Response\ResponseHeader\PRAGMA, ILIAS\FileDelivery\Delivery\sendEtagHeader(), and ILIAS\FileDelivery\Delivery\sendLastModified().

Referenced by ILIAS\FileDelivery\Delivery\checkCache().

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

◆ setConvertFileNameToAsci()

ILIAS\FileDelivery\Delivery::setConvertFileNameToAsci ( bool  $convert_file_name_to_asci)

Definition at line 332 of file Delivery.php.

332 : void
333 {
334 $this->convert_file_name_to_asci = $convert_file_name_to_asci;
335 }

References ILIAS\FileDelivery\Delivery\$convert_file_name_to_asci.

◆ setDEBUG()

static ILIAS\FileDelivery\Delivery::setDEBUG ( bool  $DEBUG)
static

Definition at line 425 of file Delivery.php.

425 : void
426 {
427 self::$DEBUG = $DEBUG;
428 }

References ILIAS\FileDelivery\Delivery\$DEBUG.

◆ setDeleteFile()

ILIAS\FileDelivery\Delivery::setDeleteFile ( bool  $delete_file)

Definition at line 523 of file Delivery.php.

523 : void
524 {
525 $this->delete_file = $delete_file;
526 }

References ILIAS\FileDelivery\Delivery\$delete_file.

◆ setDeliveryType()

ILIAS\FileDelivery\Delivery::setDeliveryType ( string  $delivery_type)

Definition at line 248 of file Delivery.php.

248 : void
249 {
250 $this->delivery_type = $delivery_type;
251 }

References ILIAS\FileDelivery\Delivery\$delivery_type.

Referenced by ILIAS\FileDelivery\Delivery\detemineDeliveryType(), and ILIAS\FileDelivery\Delivery\stream().

+ Here is the caller graph for this function:

◆ setDisposition()

ILIAS\FileDelivery\Delivery::setDisposition ( string  $disposition)

Definition at line 296 of file Delivery.php.

296 : void
297 {
298 $this->disposition = $disposition;
299 }

References ILIAS\FileDelivery\Delivery\$disposition.

◆ setDispositionHeaders()

ILIAS\FileDelivery\Delivery::setDispositionHeaders ( )
private

Definition at line 529 of file Delivery.php.

529 : void
530 {
531 $response = $this->http->response();
532 $response = $response->withHeader(
534 $this->getDisposition()
535 . '; filename="'
536 . $this->getDownloadFileName()
537 . '"'
538 );
539 $response = $response->withHeader('Content-Description', $this->getDownloadFileName());
540 $this->http->saveResponse($response);
541 }

References $response, ILIAS\HTTP\Response\ResponseHeader\CONTENT_DISPOSITION, ILIAS\FileDelivery\Delivery\getDisposition(), ILIAS\FileDelivery\Delivery\getDownloadFileName(), and ILIAS\FileDelivery\http().

Referenced by ILIAS\FileDelivery\Delivery\setGeneralHeaders().

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

◆ setDownloadFileName()

ILIAS\FileDelivery\Delivery::setDownloadFileName ( string  $download_file_name)

◆ setEtag()

ILIAS\FileDelivery\Delivery::setEtag ( string  $etag)

Definition at line 344 of file Delivery.php.

344 : void
345 {
346 $this->etag = $etag;
347 }

References ILIAS\FileDelivery\Delivery\$etag.

Referenced by ILIAS\FileDelivery\Delivery\generateEtag().

+ Here is the caller graph for this function:

◆ setExitAfter()

ILIAS\FileDelivery\Delivery::setExitAfter ( bool  $exit_after)

Definition at line 320 of file Delivery.php.

320 : void
321 {
322 $this->exit_after = $exit_after;
323 }

References ILIAS\FileDelivery\Delivery\$exit_after.

◆ setGeneralHeaders()

ILIAS\FileDelivery\Delivery::setGeneralHeaders ( )

Definition at line 126 of file Delivery.php.

126 : void
127 {
128 $this->checkExisting();
129 if ($this->isSendMimeType()) {
130 $response = $this->http->response()->withHeader(ResponseHeader::CONTENT_TYPE, $this->getMimeType());
131 $this->http->saveResponse($response);
132 }
133 if ($this->isConvertFileNameToAsci()) {
134 $this->cleanDownloadFileName();
135 }
136 if ($this->hasHashFilename()) {
137 $this->setDownloadFileName(md5($this->getDownloadFileName()));
138 }
139 $this->setDispositionHeaders();
140 $response = $this->http->response()->withHeader(ResponseHeader::ACCEPT_RANGES, 'bytes');
141 $this->http->saveResponse($response);
142 if ($this->getDeliveryType() === DeliveryMethod::PHP
143 && $this->getPathToFile() !== self::DIRECT_PHP_OUTPUT
144 ) {
145 $response = $this->http->response()->withHeader(ResponseHeader::CONTENT_LENGTH, (string) filesize($this->getPathToFile()));
146 $this->http->saveResponse($response);
147 }
148 $response = $this->http->response()->withHeader(ResponseHeader::CONNECTION, "close");
149 $this->http->saveResponse($response);
150 }
cleanDownloadFileName()
Converts the filename to ASCII.
Definition: Delivery.php:474

References $response, ILIAS\HTTP\Response\ResponseHeader\ACCEPT_RANGES, ILIAS\FileDelivery\Delivery\checkExisting(), ILIAS\FileDelivery\Delivery\cleanDownloadFileName(), ILIAS\HTTP\Response\ResponseHeader\CONNECTION, ILIAS\HTTP\Response\ResponseHeader\CONTENT_LENGTH, ILIAS\HTTP\Response\ResponseHeader\CONTENT_TYPE, ILIAS\FileDelivery\Delivery\getDeliveryType(), ILIAS\FileDelivery\Delivery\getDownloadFileName(), ILIAS\FileDelivery\Delivery\getMimeType(), ILIAS\FileDelivery\Delivery\getPathToFile(), ILIAS\FileDelivery\Delivery\hasHashFilename(), ILIAS\FileDelivery\http(), ILIAS\FileDelivery\Delivery\isConvertFileNameToAsci(), ILIAS\FileDelivery\Delivery\isSendMimeType(), ILIAS\FileDelivery\FileDeliveryTypes\DeliveryMethod\PHP, ILIAS\FileDelivery\Delivery\setDispositionHeaders(), and ILIAS\FileDelivery\Delivery\setDownloadFileName().

Referenced by ILIAS\FileDelivery\Delivery\deliver().

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

◆ setHasContext()

ILIAS\FileDelivery\Delivery::setHasContext ( bool  $has_context)

Definition at line 368 of file Delivery.php.

368 : void
369 {
370 $this->has_context = $has_context;
371 }

References ILIAS\FileDelivery\Delivery\$has_context.

Referenced by ILIAS\FileDelivery\Delivery\__construct().

+ Here is the caller graph for this function:

◆ setHashFilename()

ILIAS\FileDelivery\Delivery::setHashFilename ( bool  $hash_filename)

Definition at line 392 of file Delivery.php.

392 : void
393 {
394 $this->hash_filename = $hash_filename;
395 }

References ILIAS\FileDelivery\Delivery\$hash_filename.

◆ setMimeType()

ILIAS\FileDelivery\Delivery::setMimeType ( string  $mime_type)

Definition at line 260 of file Delivery.php.

260 : void
261 {
262 $this->mime_type = $mime_type;
263 }

References ILIAS\FileDelivery\Delivery\$mime_type.

Referenced by ILIAS\FileDelivery\Delivery\determineMimeType().

+ Here is the caller graph for this function:

◆ setPathToFile()

ILIAS\FileDelivery\Delivery::setPathToFile ( string  $path_to_file)

Definition at line 272 of file Delivery.php.

272 : void
273 {
274 $this->path_to_file = $path_to_file;
275 }

References ILIAS\FileDelivery\Delivery\$path_to_file.

Referenced by ILIAS\FileDelivery\Delivery\__construct().

+ Here is the caller graph for this function:

◆ setSendMimeType()

ILIAS\FileDelivery\Delivery::setSendMimeType ( bool  $send_mime_type)

Definition at line 308 of file Delivery.php.

308 : void
309 {
310 $this->send_mime_type = $send_mime_type;
311 }

References ILIAS\FileDelivery\Delivery\$send_mime_type.

◆ setShowLastModified()

ILIAS\FileDelivery\Delivery::setShowLastModified ( bool  $show_last_modified)

Definition at line 356 of file Delivery.php.

356 : void
357 {
358 $this->show_last_modified = $show_last_modified;
359 }

References ILIAS\FileDelivery\Delivery\$show_last_modified.

Referenced by ILIAS\FileDelivery\Delivery\checkCache().

+ Here is the caller graph for this function:

◆ stream()

ILIAS\FileDelivery\Delivery::stream ( )

Field Documentation

◆ $cache

bool ILIAS\FileDelivery\Delivery::$cache = false
private

◆ $convert_file_name_to_asci

bool ILIAS\FileDelivery\Delivery::$convert_file_name_to_asci = true
private

◆ $DEBUG

bool ILIAS\FileDelivery\Delivery::$DEBUG = false
staticprivate

◆ $delete_file

bool ILIAS\FileDelivery\Delivery::$delete_file = false
private

◆ $delivery_type

string ILIAS\FileDelivery\Delivery::$delivery_type = DeliveryMethod::PHP
private

◆ $delivery_type_static

string ILIAS\FileDelivery\Delivery::$delivery_type_static = null
staticprivate

Definition at line 43 of file Delivery.php.

◆ $disposition

string ILIAS\FileDelivery\Delivery::$disposition = self::DISP_ATTACHMENT
private

◆ $download_file_name

string ILIAS\FileDelivery\Delivery::$download_file_name = ''
private

◆ $etag

string ILIAS\FileDelivery\Delivery::$etag = ''
private

◆ $exit_after

bool ILIAS\FileDelivery\Delivery::$exit_after = true
private

◆ $factory

FileDeliveryTypeFactory ILIAS\FileDelivery\Delivery::$factory
private

Definition at line 60 of file Delivery.php.

◆ $has_context

bool ILIAS\FileDelivery\Delivery::$has_context = true
private

◆ $hash_filename

bool ILIAS\FileDelivery\Delivery::$hash_filename = false
private

◆ $http

Services ILIAS\FileDelivery\Delivery::$http
private

Definition at line 59 of file Delivery.php.

Referenced by ILIAS\FileDelivery\Delivery\__construct().

◆ $mime_type

string ILIAS\FileDelivery\Delivery::$mime_type = ''
private

◆ $path_to_file

string ILIAS\FileDelivery\Delivery::$path_to_file = ''
private

◆ $send_mime_type

bool ILIAS\FileDelivery\Delivery::$send_mime_type = true
private

◆ $show_last_modified

bool ILIAS\FileDelivery\Delivery::$show_last_modified = true
private

◆ DIRECT_PHP_OUTPUT

const ILIAS\FileDelivery\Delivery::DIRECT_PHP_OUTPUT = 'php://output'

Definition at line 39 of file Delivery.php.

◆ DISP_ATTACHMENT

const ILIAS\FileDelivery\Delivery::DISP_ATTACHMENT = 'attachment'

Definition at line 40 of file Delivery.php.

◆ DISP_INLINE

const ILIAS\FileDelivery\Delivery::DISP_INLINE = 'inline'

Definition at line 41 of file Delivery.php.

◆ EXPIRES_IN

const ILIAS\FileDelivery\Delivery::EXPIRES_IN = '+5 days'

Definition at line 42 of file Delivery.php.


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