ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ContainerURIConsumer.php
Go to the documentation of this file.
1 <?php
2 
20 
24 use ILIAS\Data\URI;
26 
31 {
32  use GetRevisionTrait;
33 
34  private Archives $archives;
35  protected ?int $revision_number = null;
36 
40  public function __construct(
41  private SrcBuilder $src_builder,
42  private StorableResource $resource,
43  private StreamAccess $stream_access,
44  private string $start_file,
45  private float $valid_for_at_least_minutes = 60.0
46  ) {
47  global $DIC;
48  $this->archives = $DIC->archives();
49  }
50 
51  public function getURI(): ?URI
52  {
53  $filename = basename($this->start_file);
54  if ($filename === '') {
55  $filename = null;
56  }
57 
58  $startfile = urlencode($this->start_file); // e.g. for files with " " (spaces)
59  $startfile = str_replace(urlencode("/"), "/", $startfile); // we must keep directory sepparators
60 
61  $uri_string = $this->src_builder->getRevisionURL(
62  $this->stream_access->populateRevision($this->getRevision()),
63  true,
64  $this->valid_for_at_least_minutes,
65  $filename
66  ) . StreamDelivery::SUBREQUEST_SEPARATOR . $startfile;
67 
68  try {
69  return new URI($uri_string);
70  } catch (\Throwable) {
71  return null;
72  }
73  }
74 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
__construct(private SrcBuilder $src_builder, private StorableResource $resource, private StreamAccess $stream_access, private string $start_file, private float $valid_for_at_least_minutes=60.0)
DownloadConsumer constructor.
$filename
Definition: buildRTE.php:78