19 declare(strict_types=1);
    97         $this->primary_storage_handler = $storage_handler_factory->
getPrimary();
   117         $resource = $this->resource_repository->blank(
   118             $this->primary_storage_handler->getIdentificationGenerator()->getUniqueResourceIdentification(),
   122         return $this->
append($resource, $result, $info_resolver, RevisionStatus::PUBLISHED);
   128         bool $keep_original = 
false,
   131         $resource = $this->resource_repository->blank(
   132             $this->primary_storage_handler->getIdentificationGenerator()->getUniqueResourceIdentification(),
   140             RevisionStatus::PUBLISHED,
   147         $resource = $this->resource_repository->blank(
   148             $this->primary_storage_handler->getIdentificationGenerator()->getUniqueResourceIdentification(),
   151         $resource->
setStorageID($this->primary_storage_handler->getID());
   169             throw new \LogicException(
   170                 'You can not replace a draft revision with a published, you must publish the current revision first'   174         $new_revision = $this->revision_repository->blankFromUpload($info_resolver, $resource, $result, $status);
   200             throw new \LogicException(
'You can not replace a draft revision, you must publish it first');
   202         $revision = $this->revision_repository->blankFromUpload(
   206             RevisionStatus::PUBLISHED
   227         bool $keep_original = 
false,
   232             throw new \LogicException(
   233                 'You can not replace a draft revision with a published, you must publish the current revision first'   237         $new_revision = $this->revision_repository->blankFromStream(
   264         bool $keep_original = 
false,
   267             throw new \LogicException(
'You can not replace a draft revision, you must publish it first');
   269         $revision = $this->revision_repository->blankFromStream(
   273             RevisionStatus::PUBLISHED,
   295             throw new \LogicException(
'You can not replace a draft revision, you must publish it first');
   304             $cloned_revision = $this->revision_repository->blankFromClone(
   332         $stream_replacement->
setVersionNumber($current_revision->getVersionNumber());
   335         return $stream_replacement;
   343         return $this->resource_repository->has($identification);
   353             $this->file_name_policy->check($revision->getInformation()->getSuffix());
   356         $r = $this->lock_handler->lockTables(
   358                 $this->resource_repository->getNamesForLocking(),
   359                 $this->revision_repository->getNamesForLocking(),
   360                 $this->information_repository->getNamesForLocking(),
   361                 $this->stakeholder_repository->getNamesForLocking()
   363             function () use ($resource): 
void {
   364                 $this->resource_repository->store($resource);
   371                     $this->stakeholder_repository->register($resource->
getIdentification(), $stakeholder);
   386             $stakeholder = 
clone $stakeholder;
   387             $new_resource->addStakeholder($stakeholder);
   395                 $existing_revision->getVersionNumber(),
   399             $existing_revision = $this->stream_access->populateRevision($existing_revision);
   402                 $new_resource->getIdentification(),
   403                 $existing_revision->maybeStreamResolver()->getStream(),
   408             $cloned_revision->setVersionNumber($existing_revision->getVersionNumber());
   410             $new_resource->addRevision($cloned_revision);
   412         $this->
store($new_resource);
   413         return $new_resource;
   423             ? $this->primary_storage_handler
   424             : $this->storage_handler_factory->getHandlerForRevision($revision);
   428             $this->file_name_policy->check($revision->
getInformation()->getSuffix());
   429             $storage_handler->storeUpload($revision);
   432             $storage_handler->storeStream($revision);
   435             $storage_handler->cloneRevision($revision);
   438             $storage_handler->streamReplacement($revision);
   440         $this->revision_repository->store($revision);
   441         $this->information_repository->store($revision->
getInformation(), $revision);
   444         if ($resource !== null) {
   447             $replace_revision->setOwnerId($revision->
getOwnerId());
   448             $replace_revision->setTitle($revision->
getTitle());
   449             $replace_revision->setStatus($revision->
getStatus());
   451             $replace_revision->setStorageID($revision->
getStorageID());
   453             $resource->replaceRevision($replace_revision);
   463         if (isset($this->resource_cache[$identification->serialize()])) {
   464             return $this->resource_cache[$identification->serialize()];
   466         $resource = $this->resource_repository->get($identification);
   468         if ($this->auto_migrate && $resource->getStorageID() !== $this->primary_storage_handler->getID()) {
   472             $migrator->migrate($resource, $this->primary_storage_handler->getID());
   473             $resource->setStorageID($this->primary_storage_handler->getID());
   480         return $this->resource_cache[$identification->serialize()];
   486         if ($revision->getStatus() === RevisionStatus::PUBLISHED) {
   489         $revision->setStatus(RevisionStatus::PUBLISHED);
   490         $this->
store($resource);
   501         $this->
store($resource);
   513                 return $revision->getRevisionToClone()->getStream();
   516                     return $this->storage_handler_factory->getHandlerForRevision(
   518                     )->getStream($revision);
   521                 return $this->storage_handler_factory->getHandlerForResource(
   523                 )->getStream($revision);
   525                 throw new \LogicException(
'This revision type is not supported');
   538             $this->stakeholder_repository->deregister($resource->
getIdentification(), $stakeholder);
   539             $sucessful = $stakeholder->resourceHasBeenDeleted($resource->
getIdentification());
   546             $sucessful = $s->resourceHasBeenDeleted($resource->
getIdentification()) && $sucessful;
   553         $this->storage_handler_factory->getHandlerForResource($resource)->deleteResource($resource);
   554         $this->resource_repository->delete($resource);
   562         if ($reveision_to_delete !== null) {
   565         $this->
store($resource);
   571         string $path_inside_container,
   578             $zip = new \ZipArchive();
   579             $zip->open($stream->getMetadata()[
'uri']);
   580             $path_inside_container = $this->
ensurePathInZIP($zip, $path_inside_container, 
false);
   584             $this->storage_handler_factory->getHandlerForRevision($revision)->clearFlavours($revision);
   585             $revision->getInformation()->setSize(filesize($stream->getMetadata()[
'uri']));
   596         if ($path === 
'' || $path === 
'/') {
   603             $path = dirname($path);
   608         $parts = explode(
'/', $path);
   609         $root = array_shift(
$parts);
   610         $root = $root === 
'' ? array_shift(
$parts) : $root;
   613         if ($zip->locateName($root . 
'/') !== 
false) {
   615         } elseif ($zip->locateName(
'/' . $root . 
'/') !== 
false) {
   620             $zip->addEmptyDir($root);
   623         $path_inside_container = $root;
   624         foreach (
$parts as $part) {
   625             $path_inside_container .= 
'/' . $part;
   626             if ($zip->locateName($path_inside_container . 
'/') === 
false) {
   627                 $zip->addEmptyDir($path_inside_container . 
'/');
   631         return rtrim($path_inside_container, 
'/') . 
'/' . 
$filename;
   636         string $path_inside_container,
   643             $zip = new \ZipArchive();
   644             $zip->open($stream->getMetadata()[
'uri']);
   646             $return = $zip->deleteName($path_inside_container);
   648             for ($i = 0; $i < $zip->numFiles; $i++) {
   649                 $path = $zip->getNameIndex($i);
   650                 if (
$path === 
false) {
   653                 if (strpos(
$path, $path_inside_container) === 0) {
   654                     $zip->deleteIndex($i);
   661             $this->storage_handler_factory->getHandlerForRevision($revision)->clearFlavours($revision);
   662             $revision->getInformation()->setSize(filesize($stream->getMetadata()[
'uri']));
   667             $this->storage_handler_factory->getHandlerForRevision($revision)->clearFlavours($revision);
   675         string $parent_path_inside_container,
   682             $zip = new \ZipArchive();
   683             $zip->open($stream->getMetadata()[
'uri']);
   685             $parent_path_inside_container = $this->
ensurePathInZIP($zip, $parent_path_inside_container, 
false);
   687             $path_inside_zip = rtrim($parent_path_inside_container, 
'/') . 
'/' . $result->
getName();
   689             $return = $zip->addFile(
   696             $this->storage_handler_factory->getHandlerForRevision($revision)->clearFlavours($revision);
   697             $revision->getInformation()->setSize(filesize($stream->getMetadata()[
'uri']));
   711         string $path_inside_container,
   717             $zip = new \ZipArchive();
   718             $zip->open($revision_stream->getMetadata()[
'uri']);
   720             $path_inside_container = $this->
ensurePathInZIP($zip, $path_inside_container, 
true);
   722             $return = $zip->addFromString(
   723                 $path_inside_container,
   729             $this->storage_handler_factory->getHandlerForRevision($revision)->clearFlavours($revision);
   730             $revision->getInformation()->setSize(filesize($revision_stream->getMetadata()[
'uri']));
   744             $this->storage_handler_factory->getHandlerForResource($resource)->deleteRevision($revision);
   748         $this->information_repository->delete($revision->
getInformation(), $revision);
   749         $this->revision_repository->delete($revision);
   755         $revisions = $this->revision_repository->get($resource);
   758         foreach ($revisions->getAll(
true) as $i => $revision) {
   759             $information = $this->information_repository->get($revision);
   760             $revision->setInformation($information);
   765         foreach ($this->stakeholder_repository->getStakeholders($resource->
getIdentification()) as $s) {
   776         $info->setTitle($this->secure($info_resolver->
getFileName()));
   778         $info->setSuffix($this->secure($info_resolver->
getSuffix()));
   779         $info->setSize($info_resolver->
getSize());
   784         $revision->setOwnerId($info_resolver->
getOwnerId());
 
setVersionNumber(int $version_number)
 
populateRevisionInfo(Revision $revision, InfoResolver $info_resolver)
 
removePathInsideContainer(StorableContainerResource $container, string $path_inside_container,)
 
newFromStream(FileStream $stream, InfoResolver $info_resolver, bool $keep_original=false, ResourceType $type=ResourceType::SINGLE_FILE)
 
StorageHandlerFactory $storage_handler_factory
 
removeRevision(StorableResource $resource, int $revision_number)
 
removeRevision(Revision $revision)
 
getInformationRepository()
 
replaceWithUpload(StorableResource $resource, UploadResult $result, InfoResolver $info_resolver)
 
Interface StorageResource. 
 
replaceWithStream(StorableResource $resource, FileStream $stream, InfoResolver $info_resolver, bool $keep_original=false,)
 
getCurrentRevisionIncludingDraft()
 
addRevision(Revision $revision)
 
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
 
clone(StorableResource $resource)
Clone anexisting resource with all it's revisions, stakeholders and information 
 
storeRevision(Revision $revision, ?StorableResource $resource=null)
Store one Revision 
 
__construct(StorageHandlerFactory $storage_handler_factory, Repositories $repositories, LockHandler $lock_handler, StreamAccess $stream_access, FileNamePolicy $file_name_policy=null)
ResourceBuilder constructor. 
 
Class UploadedFileRevision. 
 
buildDraftReplacementRevision(StorableResource $resource, Revision $new_revision, InfoResolver $info_resolver)
 
publish(StorableResource $resource)
 
StreamAccess $stream_access
 
Class UploadedFileRevision. 
 
setRevisions(RevisionCollection $collection)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Interface FileNamePolicy. 
 
addUploadToContainer(StorableContainerResource $container, UploadResult $result, string $parent_path_inside_container,)
 
ILIAS ResourceStorage Revision Repository RevisionRepository $revision_repository
 
ILIAS ResourceStorage Resource Repository ResourceRepository $resource_repository
 
getStakeholderRepository()
 
Class NoneFileNamePolicy. 
 
setStorageID(string $storage_id)
 
setInformation(Information $information)
 
unpublish(StorableResource $resource)
 
createDirectoryInsideContainer(StorableContainerResource $container, string $path_inside_container,)
 
deleteRevision(StorableResource $resource, Revision $revision)
 
populateNakedResourceWithRevisionsAndStakeholders(StorableResource $resource)
 
Class ResourceIdentification. 
 
getMaxRevision(bool $including_drafts=false)
 
setStatus(RevisionStatus $status)
 
getCurrentRevisionIncludingDraft()
 
static ofReattachableResource($resource)
 
replaceRevision(Revision $revision)
 
extractStream(Revision $revision)
 
store(StorableResource $resource)
after you have modified a resource, you can store it here 
 
ensurePathInZIP(\ZipArchive $zip, string $path, bool $is_file)
 
ILIAS ResourceStorage Policy FileNamePolicy $file_name_policy
 
setVersionNumber(int $version_number)
 
getSpecificRevision(int $number)
 
appendFromStream(StorableResource $resource, FileStream $stream, InfoResolver $info_resolver, RevisionStatus $status, bool $keep_original=false,)
 
Class StorageHandlerFactory. 
 
has(ResourceIdentification $identification)
check if a resource exists 
 
ILIAS ResourceStorage Information Repository InformationRepository $information_repository
 
removeStakeholder(ResourceStakeholder $s)
 
newBlank(ResourceType $type=ResourceType::SINGLE_FILE)
 
Interface ResourceStakeholder. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
ILIAS ResourceStorage StorageHandler StorageHandler $primary_storage_handler
 
addStakeholder(ResourceStakeholder $s)
 
getAllRevisionsIncludingDraft()
 
appendFromRevision(StorableResource $resource, int $revision_number)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
append(StorableResource $resource, UploadResult $result, InfoResolver $info_resolver, RevisionStatus $status)
 
The base interface for all filesystem streams. 
 
addStreamToContainer(StorableContainerResource $container, FileStream $stream, string $path_inside_container,)
 
LockHandler $lock_handler
 
ILIAS ResourceStorage Stakeholder Repository StakeholderRepository $stakeholder_repository