ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ContainerURIConsumer.php
Go to the documentation of this file.
1 <?php
2 
20 
25 use ILIAS\Data\URI;
27 
32 {
33  use GetRevisionTrait;
34 
36  protected ?int $revision_number = null;
38 
42  public function __construct(
43  private SrcBuilder $src_builder,
44  StorableContainerResource $resource,
45  private StreamAccess $stream_access,
46  private string $start_file,
47  private float $valid_for_at_least_minutes = 60.0
48  ) {
49  global $DIC;
50  $this->resource = $resource;
51  $this->archives = $DIC->archives();
52  }
53 
54  public function getURI(): ?URI
55  {
56  $filename = basename($this->start_file);
57  if ($filename === '') {
58  $filename = null;
59  }
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 . urlencode($this->start_file);
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...
global $DIC
Definition: feed.php:28
The scope of this class is split ilias-conform URI&#39;s into components.
Definition: URI.php:18
$filename
Definition: buildRTE.php:78
__construct(private SrcBuilder $src_builder, StorableContainerResource $resource, private StreamAccess $stream_access, private string $start_file, private float $valid_for_at_least_minutes=60.0)
DownloadConsumer constructor.