19declare(strict_types=1);
28use ILIAS\WebDAV\DataCheck;
46 $this->manager =
$DIC->resourceStorage()->manage();
47 $this->consumer =
$DIC->resourceStorage()->consume();
48 $this->stakeholder = new \ilObjFileStakeholder();
53 if ($this->resource_identification ===
null) {
57 return $this->consumer->stream($this->resource_identification)->getStream();
58 }
catch (\Throwable) {
63 public function put(
string $title, mixed
$data,
bool $publish): bool
65 if (is_resource(
$data)) {
78 $placeholder_revision_number =
null;
79 $resource = $this->manager->getResource($this->resource_identification);
80 if (count($resource->getAllRevisionsIncludingDraft()) === 1) {
81 $only = $resource->getCurrentRevisionIncludingDraft();
83 $placeholder_revision_number = $only->getVersionNumber();
87 $this->manager->appendNewRevisionFromStream(
88 $this->resource_identification,
96 $this->manager->publish($this->resource_identification);
99 if ($placeholder_revision_number !==
null && $publish) {
100 $this->manager->removeRevision(
101 $this->resource_identification,
102 $placeholder_revision_number
111 if ($this->manager->getCurrentRevisionIncludingDraft(
112 $this->resource_identification
115 $this->manager->publish($this->resource_identification);
Stream factory which enables the user to create streams without the knowledge of the concrete class.
static ofString(string $string)
Creates a new stream with an initial value.
static ofResource($resource)
Wraps an already created resource with the stream abstraction.
Class ResourceIdentification.
__construct(private ?ResourceIdentification $resource_identification)
put(string $title, mixed $data, bool $publish)
ilObjFileStakeholder $stakeholder
The base interface for all filesystem streams.