44 $this->storage =
$DIC->resourceStorage();
45 $this->download_with_uploaded_filename = (bool)
$DIC->clientIni()->readVariable(
47 'download_with_uploaded_filename'
54 $stream = $this->storage->consume()->stream($this->resource->getIdentification())->getStream();
55 $container = dirname($stream->getMetadata(
'uri'), 2);
57 $dir_reader =
function (
string $path) {
58 $rii =
new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($path));
61 foreach ($rii as $file) {
62 if (!$file->isDir()) {
63 $files[] = $file->getPathname();
75 $current_revision = $this->resource->getCurrentRevision();
76 $current_revision->setTitle($new_title);
77 $this->storage->manage()->updateRevision($current_revision);
83 public function getFile($a_hist_entry_id =
null)
85 $stream = $this->storage->consume()->stream($this->resource->getIdentification());
86 if ($a_hist_entry_id) {
87 $stream = $stream->setRevisionNumber($a_hist_entry_id);
89 return $stream->getStream()->getMetadata(
'uri');
97 return $this->resource->getCurrentRevision()->getInformation()->getMimeType();
105 $consumer = $this->storage->consume()->stream($this->resource->getIdentification());
107 $consumer->setRevisionNumber($a_version);
109 $stream = $consumer->getStream();
111 return dirname($stream->getMetadata(
'uri'));
119 if ($this->
isInline($a_hist_entry_id)) {
120 $consumer = $this->storage->consume()->inline($this->resource->getIdentification());
122 $consumer = $this->storage->consume()->download($this->resource->getIdentification());
126 if ($a_hist_entry_id) {
127 $revision = $this->resource->getSpecificRevision($a_hist_entry_id);
128 $consumer->setRevisionNumber($a_hist_entry_id);
130 $revision = $this->resource->getCurrentRevision();
133 if ($this->download_with_uploaded_filename) {
134 $consumer->overrideFileName($revision->getInformation()->getTitle());
136 $consumer->overrideFileName($revision->getTitle());
149 $revision = $a_hist_entry_id ?
150 $this->resource->getSpecificRevision($a_hist_entry_id) :
151 $this->resource->getCurrentRevision();
152 return \ilObjFileAccess::_isFileInline($revision->getTitle());
153 }
catch (Exception
$e) {
163 if (is_array($a_hist_entry_ids)) {
164 foreach ($a_hist_entry_ids as $id) {
165 $this->storage->manage()->removeRevision($this->resource->getIdentification(), $id);
175 return $this->resource->getCurrentRevision()->getInformation()->getSuffix();
184 foreach ($this->resource->getAllRevisions() as $revision) {
185 if (is_array($version_ids) && !in_array($revision->getVersionNumber(), $version_ids)) {
188 $information = $revision->getInformation();
190 $v->setVersion($revision->getVersionNumber());
191 $v->setHistEntryId($revision->getVersionNumber());
192 $v->setFilename($information->getTitle());
193 $v->setAction($revision->getVersionNumber() === 1 ?
'create' :
'new_version');
194 $v->setTitle($revision->getTitle());
195 $v->setDate($information->getCreationDate()->format(DATE_ATOM));
196 $v->setUserId($revision->getOwnerId() !== 0 ? $revision->getOwnerId() : 6);
197 $v->setSize($information->getSize());
205 public function export(
string $target_dir) : void
208 $relative_dir = LegacyPathHelper::createRelativePath($target_dir);
209 $filesystem = LegacyPathHelper::deriveFilesystemFrom($target_dir);
211 if ($filesystem->has($target_dir)) {
213 $filesystem->createDir($directory);
214 $stream =
$DIC->resourceStorage()->consume()->stream($this->resource->getIdentification())->getStream();
215 $filesystem->writeStream(
216 $directory .
'/' . $this->resource->getCurrentRevision()->getInformation()->getTitle(),
224 return $this->resource->getStorageID();
An exception for terminatinating execution or to throw for unit testing.
Customizing of pimple-DIC for ILIAS.
Class LegacyPathHelper The legacy path helper provides convenient functions for the integration of th...
This exception indicates that an UI component was accepted by the JF but is not backed by a real impl...
Class ilObjFileImplementationAbstract.
Class ilObjFileImplementationStorage.
getFileExtension()
@inheritDoc
isInline($a_hist_entry_id=null)
$download_with_uploaded_filename
getDirectory($a_version=0)
@inheritDoc
handleChangedObjectTitle(string $new_title)
getVersions($version_ids=null)
@inheritDoc
getFile($a_hist_entry_id=null)
@inheritDoc
deleteVersions($a_hist_entry_ids=null)
@inheritDoc
sendFile($a_hist_entry_id=null)
@inheritDoc
export(string $target_dir)
@depracated
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Interface StorageResource.
Interface ilObjFileImplementationInterface.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc