ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ILIAS\Repository\IRSS\IRSSWrapper Class Reference
+ Collaboration diagram for ILIAS\Repository\IRSS\IRSSWrapper:

Public Member Functions

 __construct (protected DataService $data)
 
 createEmptyCollection ()
 
 getCollectionForIdString (string $rcid)
 
 deleteCollectionForIdString (string $rcid, ResourceStakeholder $stakeholder)
 
 importFilesFromLegacyUploadToCollection (ResourceCollection $collection, array $file_input, ResourceStakeholder $stakeholder)
 
 importFilesFromDirectoryToCollection (ResourceCollection $collection, string $directory, ResourceStakeholder $stakeholder)
 
 getResourceIdForIdString (string $rid)
 
 importFileFromLegacyUpload (array $file_input, ResourceStakeholder $stakeholder)
 
 importFileFromUploadResult (UploadResult $result, ResourceStakeholder $stakeholder)
 
 importLocalFile (string $file, string $name, ResourceStakeholder $stakeholder)
 
 importStream (Stream $stream, ResourceStakeholder $stakeholder)
 
 renameCurrentRevision (string $rid, string $title)
 
 deliverFile (string $rid)
 
 stream (string $rid)
 
 getResourcePath (string $rid)
 
 getResource (string $rid)
 
 getCollectionResourcesInfo (ResourceCollection $collection)
 
 getResourceInfo (string $rid)
 
 clone (string $from_rc_id)
 
 cloneResource (string $from_rid)
 
 cloneContainer (string $from_rid)
 
 deleteResource (string $rid, ResourceStakeholder $stakeholder)
 
 addEntryOfZipResourceToCollection (string $rid, string $entry, ResourceCollection $target_collection, ResourceStakeholder $target_stakeholder)
 
 getStreamOfContainerEntry (string $rid, string $entry)
 
 getContainerEntryInfo (string $container_id, string $path)
 
 deliverContainerEntry (string $container_id, string $path)
 
 hasContainerEntry (string $rid, string $entry)
 Is there a better way to check this? More...
 
 getContainerStreams (string $container_id, ResourceStakeholder $stakeholder)
 
 getContainerPaths (string $container_id)
 
 getContainerEntries (string $container_id)
 
 getContainerEntriesOfPath (string $container_id, string $dir_path)
 
 addContainerDirToTargetContainer (string $source_container_id, string $target_container_id, string $source_dir_path="", string $target_dir_path="")
 
 createContainer (ResourceStakeholder $stakeholder, string $title="container.zip")
 
 createContainerFromLocalZip (string $local_zip_path, ResourceStakeholder $stakeholder)
 
 createContainerFromLocalDir (string $local_dir_path, ResourceStakeholder $stakeholder, string $container_path="", bool $recursive=true, string $title="container.zip")
 
 addLocalFileToContainer (string $rid, string $fullpath, string $path)
 
 addStringToContainer (string $rid, string $content, string $path)
 
 addDirectoryToContainer (string $rid, string $source_dir, string $target_path="")
 
 addUploadToContainer (string $rid, UploadResult $result)
 
 getContainerUri (string $rid, string $path)
 
 getContainerZip (string $rid)
 
 importFileFromLegacyUploadToContainer (string $rid, string $tmp_name, string $target_path)
 
 importFileFromUploadResultToContainer (string $rid, UploadResult $result, string $target_path)
 
 addStreamToContainer (string $rid, FileStream $stream, string $path)
 
 removePathFromContainer (string $rid, string $path)
 
 renameContainer (string $rid, string $title)
 

Protected Member Functions

 getNewCollectionId ()
 
 getNewCollectionIdAsString ()
 

Protected Attributes

 $filesystems
 
ILIAS FileDelivery Services $file_delivery
 
ILIAS FileUpload FileUpload $upload
 
ILIAS ResourceStorage Services $irss
 
Archives $archives
 

Detailed Description

Definition at line 41 of file IRSSWrapper.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Repository\IRSS\IRSSWrapper::__construct ( protected DataService  $data)

Definition at line 49 of file IRSSWrapper.php.

References $DIC, ILIAS\Filesystem\filesystems(), and ILIAS\Repository\upload().

51  {
52  global $DIC;
53 
54  if (!$DIC->isDependencyAvailable("resourceStorage")) {
55  return;
56  }
57  $this->irss = $DIC->resourceStorage();
58  $this->archives = $DIC->archives();
59  $this->upload = $DIC->upload();
60  $this->archives = $DIC->archives();
61  $this->file_delivery = $DIC->fileDelivery();
62  $this->filesystems = $DIC->filesystem();
63  }
static filesystems()
Returns the loaded filesystems.
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

Member Function Documentation

◆ addContainerDirToTargetContainer()

ILIAS\Repository\IRSS\IRSSWrapper::addContainerDirToTargetContainer ( string  $source_container_id,
string  $target_container_id,
string  $source_dir_path = "",
string  $target_dir_path = "" 
)

Definition at line 538 of file IRSSWrapper.php.

References $path, ILIAS\Repository\IRSS\IRSSWrapper\addStreamToContainer(), ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString(), and ILIAS\Repository\IRSS\IRSSWrapper\getStreamOfContainerEntry().

543  : void {
544  $reader = new ZipReader(
545  $this->irss->consume()->stream($this->getResourceIdForIdString($source_container_id))->getStream()
546  );
547  $entries = [];
548  foreach ($reader->getStructure() as $path => $entry) {
549  if (str_starts_with($entry['dirname'], $source_dir_path) && !$entry['is_dir']) {
550  $this->addStreamToContainer(
551  $target_container_id,
552  $this->getStreamOfContainerEntry($source_container_id, $path),
553  $target_dir_path . "/" . substr($path, strlen($source_dir_path))
554  );
555  }
556  }
557  }
addStreamToContainer(string $rid, FileStream $stream, string $path)
$path
Definition: ltiservices.php:29
getStreamOfContainerEntry(string $rid, string $entry)
+ Here is the call graph for this function:

◆ addDirectoryToContainer()

ILIAS\Repository\IRSS\IRSSWrapper::addDirectoryToContainer ( string  $rid,
string  $source_dir,
string  $target_path = "" 
)

Definition at line 672 of file IRSSWrapper.php.

References ILIAS\Repository\IRSS\IRSSWrapper\addLocalFileToContainer().

676  : void {
677  $source_dir = realpath($source_dir);
678  $directoryIterator = new \RecursiveDirectoryIterator(
679  $source_dir,
680  \FilesystemIterator::SKIP_DOTS
681  );
682 
683  $recursiveIterator = new \RecursiveIteratorIterator(
684  $directoryIterator,
685  \RecursiveIteratorIterator::LEAVES_ONLY
686  );
687 
688  foreach ($recursiveIterator as $fileInfo) {
689  if ($fileInfo->isFile()) {
690  $fullPath = $fileInfo->getPathname();
691  $relativePath = substr($fullPath, strlen($source_dir) + 1);
692  $files[] = $relativePath;
694  $rid,
695  $fullPath,
696  $target_path . "/" . $relativePath
697  );
698  }
699  }
700  }
addLocalFileToContainer(string $rid, string $fullpath, string $path)
+ Here is the call graph for this function:

◆ addEntryOfZipResourceToCollection()

ILIAS\Repository\IRSS\IRSSWrapper::addEntryOfZipResourceToCollection ( string  $rid,
string  $entry,
ResourceCollection  $target_collection,
ResourceStakeholder  $target_stakeholder 
)

Definition at line 388 of file IRSSWrapper.php.

References ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\ResourceCollection\add(), and ILIAS\Repository\IRSS\IRSSWrapper\getStreamOfContainerEntry().

393  {
394  $entry_parts = explode("/", $entry);
395  $stream = $this->getStreamOfContainerEntry($rid, $entry);
396  $feedback_rid = $this->irss->manage()->stream(
397  $stream,
398  $target_stakeholder,
399  $entry_parts[2]
400  );
401  $target_collection->add($feedback_rid);
402  $this->irss->collection()->store($target_collection);
403  }
getStreamOfContainerEntry(string $rid, string $entry)
+ Here is the call graph for this function:

◆ addLocalFileToContainer()

ILIAS\Repository\IRSS\IRSSWrapper::addLocalFileToContainer ( string  $rid,
string  $fullpath,
string  $path 
)

Definition at line 636 of file IRSSWrapper.php.

References $id, and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

Referenced by ILIAS\Repository\IRSS\IRSSWrapper\addDirectoryToContainer(), ILIAS\Repository\IRSS\IRSSWrapper\createContainerFromLocalDir(), and ILIAS\Repository\IRSS\IRSSWrapper\importFileFromLegacyUploadToContainer().

640  : void {
641  $id = $this->getResourceIdForIdString($rid);
642  $stream = fopen($fullpath, 'r');
643  $fs = new Stream($stream);
644  $this->irss->manageContainer()->removePathInsideContainer($id, $path);
645  $this->irss->manageContainer()->addStreamToContainer(
646  $id,
647  $fs,
648  $path
649  );
650  fclose($stream);
651  }
$path
Definition: ltiservices.php:29
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addStreamToContainer()

ILIAS\Repository\IRSS\IRSSWrapper::addStreamToContainer ( string  $rid,
FileStream  $stream,
string  $path 
)

Definition at line 805 of file IRSSWrapper.php.

References $id, and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

Referenced by ILIAS\Repository\IRSS\IRSSWrapper\addContainerDirToTargetContainer().

809  : void {
810  $id = $this->getResourceIdForIdString($rid);
811 
812  if (!is_null($id)) {
813  $this->irss->manageContainer()->addStreamToContainer(
814  $id,
815  $stream,
816  $path
817  );
818  }
819  }
$path
Definition: ltiservices.php:29
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addStringToContainer()

ILIAS\Repository\IRSS\IRSSWrapper::addStringToContainer ( string  $rid,
string  $content,
string  $path 
)

Definition at line 653 of file IRSSWrapper.php.

References $id, and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

657  : void {
658  $id = $this->getResourceIdForIdString($rid);
659  $stream = fopen('php://memory', 'r+');
660  fwrite($stream, $content);
661  rewind($stream);
662  $fs = new Stream($stream);
663  $this->irss->manageContainer()->removePathInsideContainer($id, $path);
664  $this->irss->manageContainer()->addStreamToContainer(
665  $id,
666  $fs,
667  $path
668  );
669  fclose($stream);
670  }
$path
Definition: ltiservices.php:29
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ addUploadToContainer()

ILIAS\Repository\IRSS\IRSSWrapper::addUploadToContainer ( string  $rid,
UploadResult  $result 
)

Definition at line 702 of file IRSSWrapper.php.

References $id, and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

705  : void {
706  $id = $this->getResourceIdForIdString($rid);
707  $this->irss->manageContainer()->addUploadToContainer(
708  $id,
709  $result,
710  "images"
711  );
712  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ clone()

ILIAS\Repository\IRSS\IRSSWrapper::clone ( string  $from_rc_id)

Definition at line 348 of file IRSSWrapper.php.

350  : string {
351  if ($from_rc_id !== "") {
352  $cloned_rcid = $this->irss->collection()->clone($this->irss->collection()->id($from_rc_id));
353  return $cloned_rcid->serialize();
354  }
355  return "";
356  }

◆ cloneContainer()

ILIAS\Repository\IRSS\IRSSWrapper::cloneContainer ( string  $from_rid)

Definition at line 368 of file IRSSWrapper.php.

References ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

370  : string {
371  if ($from_rid !== "") {
372  $cloned_rid = $this->irss->manageContainer()->clone($this->getResourceIdForIdString($from_rid));
373  return $cloned_rid->serialize();
374  }
375  return "";
376  }
+ Here is the call graph for this function:

◆ cloneResource()

ILIAS\Repository\IRSS\IRSSWrapper::cloneResource ( string  $from_rid)

Definition at line 358 of file IRSSWrapper.php.

References ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

360  : string {
361  if ($from_rid !== "") {
362  $cloned_rid = $this->irss->manage()->clone($this->getResourceIdForIdString($from_rid));
363  return $cloned_rid->serialize();
364  }
365  return "";
366  }
+ Here is the call graph for this function:

◆ createContainer()

ILIAS\Repository\IRSS\IRSSWrapper::createContainer ( ResourceStakeholder  $stakeholder,
string  $title = "container.zip" 
)

Definition at line 559 of file IRSSWrapper.php.

References ilFileUtils\delDir(), ILIAS\Filesystem\filesystems(), and ilFileUtils\ilTempnam().

Referenced by ILIAS\Repository\IRSS\IRSSWrapper\createContainerFromLocalDir().

562  : string {
563  if ($title === "") {
564  throw new \ilException("Container title missing.");
565  }
566  // create empty container resource. empty zips are not allowed, we need at least one file which is hidden
567  $tmp_dir_info = new \SplFileInfo(\ilFileUtils::ilTempnam());
568  $this->filesystems->temp()->createDir($tmp_dir_info->getFilename());
569  $tmp_dir = $tmp_dir_info->getRealPath();
570  $options = (new ZipOptions())
571  ->withZipOutputName($title)
572  ->withZipOutputPath($tmp_dir);
573  $empty_zip = $this->archives->zip(
574  [],
575  $options
576  );
577  $rid = $this->irss->manageContainer()->containerFromStream(
578  $empty_zip->get(),
579  $stakeholder,
580  $title
581  );
582  \ilFileUtils::delDir($tmp_dir);
583  return $rid->serialize();
584  }
static filesystems()
Returns the loaded filesystems.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createContainerFromLocalDir()

ILIAS\Repository\IRSS\IRSSWrapper::createContainerFromLocalDir ( string  $local_dir_path,
ResourceStakeholder  $stakeholder,
string  $container_path = "",
bool  $recursive = true,
string  $title = "container.zip" 
)

Definition at line 600 of file IRSSWrapper.php.

References ILIAS\Repository\IRSS\IRSSWrapper\addLocalFileToContainer(), and ILIAS\Repository\IRSS\IRSSWrapper\createContainer().

606  : string {
607  $real_dir_path = realpath($local_dir_path);
608  $rid = $this->createContainer($stakeholder, $title);
609  if ($recursive) {
610  $iterator = new \RecursiveIteratorIterator(
612  $local_dir_path,
613  \RecursiveDirectoryIterator::SKIP_DOTS | \RecursiveDirectoryIterator::CURRENT_AS_SELF
614  ),
615  \RecursiveIteratorIterator::SELF_FIRST
616  );
617  } else {
618  $iterator = new \DirectoryIterator($local_dir_path);
619  }
620  if ($container_path !== "") {
621  $container_path = $container_path . "/";
622  }
623  foreach ($iterator as $file) {
624  if (!$file->isDir() && !$file->isDot()) {
625  $file->getRealPath();
627  $rid,
628  $file->getRealPath(),
629  $container_path . substr($file->getRealPath(), strlen($real_dir_path) + 1)
630  );
631  }
632  }
633  return $rid;
634  }
createContainer(ResourceStakeholder $stakeholder, string $title="container.zip")
addLocalFileToContainer(string $rid, string $fullpath, string $path)
+ Here is the call graph for this function:

◆ createContainerFromLocalZip()

ILIAS\Repository\IRSS\IRSSWrapper::createContainerFromLocalZip ( string  $local_zip_path,
ResourceStakeholder  $stakeholder 
)

Definition at line 586 of file IRSSWrapper.php.

589  : string {
590  $stream = fopen($local_zip_path, 'r');
591  $fs = new Stream($stream);
592 
593  $rid = $this->irss->manageContainer()->containerFromStream(
594  $fs,
595  $stakeholder
596  );
597  return $rid->serialize();
598  }

◆ createEmptyCollection()

ILIAS\Repository\IRSS\IRSSWrapper::createEmptyCollection ( )

Definition at line 75 of file IRSSWrapper.php.

References ILIAS\Repository\IRSS\IRSSWrapper\getNewCollectionId().

75  : string
76  {
77  $new_id = $this->getNewCollectionId();
78  $new_collection = $this->irss->collection()->get($new_id);
79  $this->irss->collection()->store($new_collection);
80  return $new_id->serialize();
81  }
+ Here is the call graph for this function:

◆ deleteCollectionForIdString()

ILIAS\Repository\IRSS\IRSSWrapper::deleteCollectionForIdString ( string  $rcid,
ResourceStakeholder  $stakeholder 
)

Definition at line 88 of file IRSSWrapper.php.

References $id.

91  : void {
92  $id = $this->irss->collection()->id($rcid);
93  $this->irss->collection()->remove($id, $stakeholder, true);
94  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ deleteResource()

ILIAS\Repository\IRSS\IRSSWrapper::deleteResource ( string  $rid,
ResourceStakeholder  $stakeholder 
)

Definition at line 378 of file IRSSWrapper.php.

References $res, and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

378  : void
379  {
380  if ($rid !== "") {
381  $res = $this->getResourceIdForIdString($rid);
382  if ($res) {
383  $this->irss->manage()->remove($this->getResourceIdForIdString($rid), $stakeholder);
384  }
385  }
386  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ deliverContainerEntry()

ILIAS\Repository\IRSS\IRSSWrapper::deliverContainerEntry ( string  $container_id,
string  $path 
)

Definition at line 430 of file IRSSWrapper.php.

References $info, ILIAS\components\ResourceStorage\Container\Wrapper\ZipReader\getItem(), and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

433  : void {
434  $reader = new ZipReader(
435  $this->irss->consume()->stream($this->getResourceIdForIdString($container_id))->getStream()
436  );
437  [$stream, $info] = $reader->getItem($path);
438 
439  $this->file_delivery->delivery()->deliver(
440  $stream,
441  $info['basename'],
442  $info['mime_type'],
443  Disposition::ATTACHMENT
444  );
445  }
$path
Definition: ltiservices.php:29
$info
Definition: entry_point.php:21
+ Here is the call graph for this function:

◆ deliverFile()

ILIAS\Repository\IRSS\IRSSWrapper::deliverFile ( string  $rid)

Definition at line 275 of file IRSSWrapper.php.

References $id, and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

275  : void
276  {
277  $id = $this->getResourceIdForIdString($rid);
278  if ($id) {
279  $revision = $this->irss->manage()->getCurrentRevision($id);
280  $this->irss->consume()->download($id)->overrideFileName($revision->getTitle())->run();
281  }
282  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getCollectionForIdString()

ILIAS\Repository\IRSS\IRSSWrapper::getCollectionForIdString ( string  $rcid)

Definition at line 83 of file IRSSWrapper.php.

83  : ResourceCollection
84  {
85  return $this->irss->collection()->get($this->irss->collection()->id($rcid));
86  }

◆ getCollectionResourcesInfo()

ILIAS\Repository\IRSS\IRSSWrapper::getCollectionResourcesInfo ( ResourceCollection  $collection)

Definition at line 311 of file IRSSWrapper.php.

References $info, and ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\ResourceCollection\getResourceIdentifications().

313  : \Generator {
314  foreach ($collection->getResourceIdentifications() as $rid) {
315  $info = $this->irss->manage()->getResource($rid)
316  ->getCurrentRevision()
317  ->getInformation();
318  $src = $this->irss->consume()->src($rid)->getSrc();
319  yield $this->data->resourceInformation(
320  $rid->serialize(),
321  $info->getTitle(),
322  $info->getSize(),
323  $info->getCreationDate()->getTimestamp(),
324  $info->getMimeType(),
325  $src
326  );
327  }
328  }
$info
Definition: entry_point.php:21
+ Here is the call graph for this function:

◆ getContainerEntries()

ILIAS\Repository\IRSS\IRSSWrapper::getContainerEntries ( string  $container_id)

Definition at line 511 of file IRSSWrapper.php.

References ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString(), and ILIAS\components\ResourceStorage\Container\Wrapper\ZipReader\getStructure().

513  : array {
514  $reader = new ZipReader(
515  $this->irss->consume()->stream($this->getResourceIdForIdString($container_id))->getStream()
516  );
517  return $reader->getStructure();
518  }
+ Here is the call graph for this function:

◆ getContainerEntriesOfPath()

ILIAS\Repository\IRSS\IRSSWrapper::getContainerEntriesOfPath ( string  $container_id,
string  $dir_path 
)

Definition at line 520 of file IRSSWrapper.php.

References $path, and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

523  : array {
524  $reader = new ZipReader(
525  $this->irss->consume()->stream($this->getResourceIdForIdString($container_id))->getStream()
526  );
527  $entries = [];
528  foreach ($reader->getStructure() as $path => $entry) {
529  $dirname = $entry['dirname'] ?? '';
530  if ($dirname !== $dir_path) {
531  continue;
532  }
533  $entries[$path] = $entry;
534  }
535  return $entries;
536  }
$path
Definition: ltiservices.php:29
+ Here is the call graph for this function:

◆ getContainerEntryInfo()

ILIAS\Repository\IRSS\IRSSWrapper::getContainerEntryInfo ( string  $container_id,
string  $path 
)

Definition at line 420 of file IRSSWrapper.php.

References ILIAS\components\ResourceStorage\Container\Wrapper\ZipReader\getItem(), and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

423  : array {
424  $reader = new ZipReader(
425  $this->irss->consume()->stream($this->getResourceIdForIdString($container_id))->getStream()
426  );
427  return $reader->getItem($path)[1];
428  }
$path
Definition: ltiservices.php:29
+ Here is the call graph for this function:

◆ getContainerPaths()

ILIAS\Repository\IRSS\IRSSWrapper::getContainerPaths ( string  $container_id)

Definition at line 501 of file IRSSWrapper.php.

References $path, and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

503  : \Generator {
504  foreach ($this->irss->consume()->containerZIP(
505  $this->getResourceIdForIdString($container_id)
506  )->getZIP()->getPaths() as $path) {
507  yield $path;
508  }
509  }
$path
Definition: ltiservices.php:29
+ Here is the call graph for this function:

◆ getContainerStreams()

ILIAS\Repository\IRSS\IRSSWrapper::getContainerStreams ( string  $container_id,
ResourceStakeholder  $stakeholder 
)
Returns
<Stream>

Definition at line 490 of file IRSSWrapper.php.

References ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

493  : \Generator {
494  foreach ($this->irss->consume()->containerZIP(
495  $this->getResourceIdForIdString($container_id)
496  )->getZIP()->getFileStreams() as $stream) {
497  yield $stream;
498  }
499  }
+ Here is the call graph for this function:

◆ getContainerUri()

ILIAS\Repository\IRSS\IRSSWrapper::getContainerUri ( string  $rid,
string  $path 
)

Definition at line 714 of file IRSSWrapper.php.

References $id, and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

717  : string {
718  $id = $this->getResourceIdForIdString($rid);
719  $uri = $this->irss->consume()->containerURI(
720  $id,
721  $path,
722  8 * 60
723  )->getURI();
724  // temp fixes wrong slash escaping, maybe due to 24805bcaabb33b1c5c82609dbe6791c55577c6a4
725  $uri = str_replace("%2F", "/", (string) $uri);
726  return (string) $uri;
727  }
$path
Definition: ltiservices.php:29
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getContainerZip()

ILIAS\Repository\IRSS\IRSSWrapper::getContainerZip ( string  $rid)

Definition at line 729 of file IRSSWrapper.php.

References $id, and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

731  : Unzip {
732  $id = $this->getResourceIdForIdString($rid);
733  return $this->irss->consume()->containerZIP(
734  $id
735  )->getZIP();
736  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getNewCollectionId()

ILIAS\Repository\IRSS\IRSSWrapper::getNewCollectionId ( )
protected

Definition at line 65 of file IRSSWrapper.php.

Referenced by ILIAS\Repository\IRSS\IRSSWrapper\createEmptyCollection(), and ILIAS\Repository\IRSS\IRSSWrapper\getNewCollectionIdAsString().

65  : ResourceCollectionIdentification
66  {
67  return $this->irss->collection()->id();
68  }
+ Here is the caller graph for this function:

◆ getNewCollectionIdAsString()

ILIAS\Repository\IRSS\IRSSWrapper::getNewCollectionIdAsString ( )
protected

Definition at line 70 of file IRSSWrapper.php.

References ILIAS\Repository\IRSS\IRSSWrapper\getNewCollectionId().

70  : string
71  {
72  return $this->getNewCollectionId()->serialize();
73  }
+ Here is the call graph for this function:

◆ getResource()

ILIAS\Repository\IRSS\IRSSWrapper::getResource ( string  $rid)

Definition at line 302 of file IRSSWrapper.php.

References $id, ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString(), and null.

302  : ?StorableResource
303  {
304  $id = $this->getResourceIdForIdString($rid);
305  if ($id) {
306  return $this->irss->manage()->getResource($id);
307  }
308  return null;
309  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getResourceIdForIdString()

ILIAS\Repository\IRSS\IRSSWrapper::getResourceIdForIdString ( string  $rid)

Definition at line 178 of file IRSSWrapper.php.

Referenced by ILIAS\Repository\IRSS\IRSSWrapper\addContainerDirToTargetContainer(), ILIAS\Repository\IRSS\IRSSWrapper\addLocalFileToContainer(), ILIAS\Repository\IRSS\IRSSWrapper\addStreamToContainer(), ILIAS\Repository\IRSS\IRSSWrapper\addStringToContainer(), ILIAS\Repository\IRSS\IRSSWrapper\addUploadToContainer(), ILIAS\Repository\IRSS\IRSSWrapper\cloneContainer(), ILIAS\Repository\IRSS\IRSSWrapper\cloneResource(), ILIAS\Repository\IRSS\IRSSWrapper\deleteResource(), ILIAS\Repository\IRSS\IRSSWrapper\deliverContainerEntry(), ILIAS\Repository\IRSS\IRSSWrapper\deliverFile(), ILIAS\Repository\IRSS\IRSSWrapper\getContainerEntries(), ILIAS\Repository\IRSS\IRSSWrapper\getContainerEntriesOfPath(), ILIAS\Repository\IRSS\IRSSWrapper\getContainerEntryInfo(), ILIAS\Repository\IRSS\IRSSWrapper\getContainerPaths(), ILIAS\Repository\IRSS\IRSSWrapper\getContainerStreams(), ILIAS\Repository\IRSS\IRSSWrapper\getContainerUri(), ILIAS\Repository\IRSS\IRSSWrapper\getContainerZip(), ILIAS\Repository\IRSS\IRSSWrapper\getResource(), ILIAS\Repository\IRSS\IRSSWrapper\getResourceInfo(), ILIAS\Repository\IRSS\IRSSWrapper\importFileFromLegacyUploadToContainer(), ILIAS\Repository\IRSS\IRSSWrapper\importFileFromUploadResultToContainer(), ILIAS\Repository\IRSS\IRSSWrapper\removePathFromContainer(), ILIAS\Repository\IRSS\IRSSWrapper\renameContainer(), ILIAS\Repository\IRSS\IRSSWrapper\renameCurrentRevision(), and ILIAS\Repository\IRSS\IRSSWrapper\stream().

178  : ?ResourceIdentification
179  {
180  return $this->irss->manage()->find($rid);
181  }
+ Here is the caller graph for this function:

◆ getResourceInfo()

ILIAS\Repository\IRSS\IRSSWrapper::getResourceInfo ( string  $rid)

Definition at line 330 of file IRSSWrapper.php.

References $info, and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

332  : ResourceInformation {
333  $rid = $this->getResourceIdForIdString($rid);
334  $info = $this->irss->manage()->getResource($rid)
335  ->getCurrentRevision()
336  ->getInformation();
337  $src = $this->irss->consume()->src($rid)->getSrc();
338  return $this->data->resourceInformation(
339  $rid->serialize(),
340  $info->getTitle(),
341  $info->getSize(),
342  $info->getCreationDate()->getTimestamp(),
343  $info->getMimeType(),
344  $src
345  );
346  }
$info
Definition: entry_point.php:21
+ Here is the call graph for this function:

◆ getResourcePath()

ILIAS\Repository\IRSS\IRSSWrapper::getResourcePath ( string  $rid)

Definition at line 293 of file IRSSWrapper.php.

References ILIAS\Repository\IRSS\IRSSWrapper\stream().

293  : string
294  {
295  $stream = $this->stream($rid);
296  if ($stream) {
297  return $stream->getMetadata('uri') ?? '';
298  }
299  return "";
300  }
+ Here is the call graph for this function:

◆ getStreamOfContainerEntry()

ILIAS\Repository\IRSS\IRSSWrapper::getStreamOfContainerEntry ( string  $rid,
string  $entry 
)

Definition at line 409 of file IRSSWrapper.php.

References ILIAS\Filesystem\Stream\Streams\ofFileInsideZIP(), and ILIAS\Repository\IRSS\IRSSWrapper\stream().

Referenced by ILIAS\Repository\IRSS\IRSSWrapper\addContainerDirToTargetContainer(), and ILIAS\Repository\IRSS\IRSSWrapper\addEntryOfZipResourceToCollection().

412  : ZIPStream {
413  $zip_path = $this->stream($rid)->getMetadata("uri");
415  $zip_path,
416  $entry
417  );
418  }
static ofFileInsideZIP(string $path_to_zip, string $path_inside_zip)
Definition: Streams.php:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasContainerEntry()

ILIAS\Repository\IRSS\IRSSWrapper::hasContainerEntry ( string  $rid,
string  $entry 
)

Is there a better way to check this?

Definition at line 450 of file IRSSWrapper.php.

References Vendor\Package\$e, ILIAS\Filesystem\Stream\Streams\ofFileInsideZIP(), and ILIAS\Repository\IRSS\IRSSWrapper\stream().

453  : bool {
454  $zip_path = $this->stream($rid)?->getMetadata("uri");
455  try {
456  $stream = Streams::ofFileInsideZIP(
457  $zip_path,
458  $entry
459  );
460  $stream->close();
461  return true;
462  } catch (\Exception $e) {
463  return false;
464  }
465  }
static ofFileInsideZIP(string $path_to_zip, string $path_inside_zip)
Definition: Streams.php:84
+ Here is the call graph for this function:

◆ importFileFromLegacyUpload()

ILIAS\Repository\IRSS\IRSSWrapper::importFileFromLegacyUpload ( array  $file_input,
ResourceStakeholder  $stakeholder 
)

Definition at line 183 of file IRSSWrapper.php.

References ILIAS\Repository\IRSS\IRSSWrapper\$upload.

186  : string {
188 
189  if (is_array($file_input)) {
190  if (!$upload->hasBeenProcessed()) {
191  $upload->process();
192  }
193  foreach ($upload->getResults() as $name => $result) {
194  // we must check if these are files from this input
195  if ($name !== ($file_input["tmp_name"] ?? "")) {
196  continue;
197  }
198  // if the result is not OK, we skip it
199  if (!$result->isOK()) {
200  continue;
201  }
202 
203  // we store the file in the IRSS
204  $rid = $this->irss->manage()->upload(
205  $result,
206  $stakeholder
207  );
208  return $rid->serialize();
209  }
210  }
211  return "";
212  }
ILIAS FileUpload FileUpload $upload
Definition: IRSSWrapper.php:45

◆ importFileFromLegacyUploadToContainer()

ILIAS\Repository\IRSS\IRSSWrapper::importFileFromLegacyUploadToContainer ( string  $rid,
string  $tmp_name,
string  $target_path 
)

Definition at line 740 of file IRSSWrapper.php.

References $id, ILIAS\Repository\IRSS\IRSSWrapper\$upload, ILIAS\Repository\IRSS\IRSSWrapper\addLocalFileToContainer(), and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

744  : void {
746 
747  if (!$upload->hasBeenProcessed()) {
748  $upload->process();
749  }
750  foreach ($upload->getResults() as $name => $result) {
751  // we must check if these are files from this input
752  if ($name !== $tmp_name) {
753  continue;
754  }
755  // if the result is not OK, we skip it
756  if (!$result->isOK()) {
757  continue;
758  }
759 
760  $id = $this->getResourceIdForIdString($rid);
761 
762  if (!is_null($id)) {
763  // if target path is a directory, addUploadToContainer
764  // can be used, the original filename will be appended
765  if ($target_path === "" || str_ends_with($target_path, "/")) {
766  $this->irss->manageContainer()->addUploadToContainer(
767  $id,
768  $result,
769  "/"
770  );
771  } else {
772  // we have a full path given (renaming the
773  // original name)
775  $rid,
776  $result->getPath(),
777  $target_path
778  );
779  }
780  }
781  }
782  }
ILIAS FileUpload FileUpload $upload
Definition: IRSSWrapper.php:45
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
addLocalFileToContainer(string $rid, string $fullpath, string $path)
+ Here is the call graph for this function:

◆ importFileFromUploadResult()

ILIAS\Repository\IRSS\IRSSWrapper::importFileFromUploadResult ( UploadResult  $result,
ResourceStakeholder  $stakeholder 
)

Definition at line 214 of file IRSSWrapper.php.

References ILIAS\FileUpload\DTO\UploadResult\isOK().

217  : string {
218  // if the result is not OK, we skip it
219  if (!$result->isOK()) {
220  return "";
221  }
222 
223  // we store the file in the IRSS
224  $rid = $this->irss->manage()->upload(
225  $result,
226  $stakeholder
227  );
228  return $rid->serialize();
229  }
+ Here is the call graph for this function:

◆ importFileFromUploadResultToContainer()

ILIAS\Repository\IRSS\IRSSWrapper::importFileFromUploadResultToContainer ( string  $rid,
UploadResult  $result,
string  $target_path 
)

Definition at line 784 of file IRSSWrapper.php.

References $id, ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString(), and ILIAS\FileUpload\DTO\UploadResult\isOK().

788  : void {
789  // if the result is not OK, we skip it
790  if (!$result->isOK()) {
791  return;
792  }
793 
794  $id = $this->getResourceIdForIdString($rid);
795 
796  if (!is_null($id)) {
797  $this->irss->manageContainer()->addUploadToContainer(
798  $id,
799  $result,
800  $target_path
801  );
802  }
803  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ importFilesFromDirectoryToCollection()

ILIAS\Repository\IRSS\IRSSWrapper::importFilesFromDirectoryToCollection ( ResourceCollection  $collection,
string  $directory,
ResourceStakeholder  $stakeholder 
)

Definition at line 146 of file IRSSWrapper.php.

References Vendor\Package\$e, ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\ResourceCollection\add(), ILIAS\Filesystem\Util\LegacyPathHelper\createRelativePath(), and ILIAS\Filesystem\Util\LegacyPathHelper\deriveFilesystemFrom().

150  : void {
151  $sourceFS = LegacyPathHelper::deriveFilesystemFrom($directory);
152  $sourceDir = LegacyPathHelper::createRelativePath($directory);
153 
154  // check if arguments are directories
155  if (!$sourceFS->hasDir($sourceDir)) {
156  return;
157  }
158 
159  $sourceList = $sourceFS->listContents($sourceDir, false);
160 
161  foreach ($sourceList as $item) {
162  if ($item->isDir()) {
163  continue;
164  }
165  try {
166  $stream = $sourceFS->readStream($item->getPath());
167  $rid = $this->irss->manage()->stream(
168  $stream,
169  $stakeholder
170  );
171  $collection->add($rid);
172  } catch (\ILIAS\Filesystem\Exception\FileAlreadyExistsException $e) {
173  }
174  }
175  $this->irss->collection()->store($collection);
176  }
static createRelativePath(string $absolute_path)
Creates a relative path from an absolute path which starts with a valid storage location.
Interface Observer Contains several chained tasks and infos about them.
static deriveFilesystemFrom(string $absolute_path)
Tries to fetch the filesystem responsible for the absolute path.
+ Here is the call graph for this function:

◆ importFilesFromLegacyUploadToCollection()

ILIAS\Repository\IRSS\IRSSWrapper::importFilesFromLegacyUploadToCollection ( ResourceCollection  $collection,
array  $file_input,
ResourceStakeholder  $stakeholder 
)

Definition at line 112 of file IRSSWrapper.php.

References ILIAS\Repository\IRSS\IRSSWrapper\$upload, and ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection\ResourceCollection\add().

116  : void {
118 
119  if (is_array($file_input)) {
120  if (!$upload->hasBeenProcessed()) {
121  $upload->process();
122  }
123  foreach ($upload->getResults() as $name => $result) {
124  // we must check if these are files from this input
125  if (!in_array($name, $file_input["tmp_name"] ?? [], true)) {
126  continue;
127  }
128  // if the result is not OK, we skip it
129  if (!$result->isOK()) {
130  continue;
131  }
132 
133  // we store the file in the IRSS
134  $rid = $this->irss->manage()->upload(
135  $result,
136  $stakeholder
137  );
138  // and add its identification to the collection
139  $collection->add($rid);
140  }
141  // we store the collection after all files have been added
142  $this->irss->collection()->store($collection);
143  }
144  }
ILIAS FileUpload FileUpload $upload
Definition: IRSSWrapper.php:45
+ Here is the call graph for this function:

◆ importLocalFile()

ILIAS\Repository\IRSS\IRSSWrapper::importLocalFile ( string  $file,
string  $name,
ResourceStakeholder  $stakeholder 
)

Definition at line 231 of file IRSSWrapper.php.

References ILIAS\Filesystem\Util\LegacyPathHelper\createRelativePath(), and ILIAS\Filesystem\Util\LegacyPathHelper\deriveFilesystemFrom().

235  : string {
236  $sourceFS = LegacyPathHelper::deriveFilesystemFrom($file);
237  $sourceFile = LegacyPathHelper::createRelativePath($file);
238 
239  //try {
240  $stream = $sourceFS->readStream($sourceFile);
241  $rid = $this->irss->manage()->stream(
242  $stream,
243  $stakeholder,
244  $name
245  );
246  //} catch (\Exception $e) {
247  // return "";
248  //}
249  return $rid->serialize();
250  }
static createRelativePath(string $absolute_path)
Creates a relative path from an absolute path which starts with a valid storage location.
static deriveFilesystemFrom(string $absolute_path)
Tries to fetch the filesystem responsible for the absolute path.
+ Here is the call graph for this function:

◆ importStream()

ILIAS\Repository\IRSS\IRSSWrapper::importStream ( Stream  $stream,
ResourceStakeholder  $stakeholder 
)

Definition at line 252 of file IRSSWrapper.php.

255  : string {
256  $rid = $this->irss->manage()->stream(
257  $stream,
258  $stakeholder
259  );
260  return $rid->serialize();
261  }

◆ removePathFromContainer()

ILIAS\Repository\IRSS\IRSSWrapper::removePathFromContainer ( string  $rid,
string  $path 
)

Definition at line 821 of file IRSSWrapper.php.

References $id, and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

824  : void {
825  $id = $this->getResourceIdForIdString($rid);
826  if (!is_null($id)) {
827  $this->irss->manageContainer()->removePathInsideContainer($id, $path);
828  }
829  }
$path
Definition: ltiservices.php:29
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ renameContainer()

ILIAS\Repository\IRSS\IRSSWrapper::renameContainer ( string  $rid,
string  $title 
)

Definition at line 832 of file IRSSWrapper.php.

References $id, $info, and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

835  : void {
836  $id = $this->getResourceIdForIdString($rid);
837  $rev = $this->irss->manageContainer()->getCurrentRevision($id);
838  $info = $rev->getInformation();
839  $info->setTitle($title);
840  $rev->setInformation($info);
841  $this->irss->manageContainer()->updateRevision($rev);
842  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$info
Definition: entry_point.php:21
+ Here is the call graph for this function:

◆ renameCurrentRevision()

ILIAS\Repository\IRSS\IRSSWrapper::renameCurrentRevision ( string  $rid,
string  $title 
)

Definition at line 263 of file IRSSWrapper.php.

References $id, $info, and ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString().

266  : void {
267  $id = $this->getResourceIdForIdString($rid);
268  $rev = $this->irss->manage()->getCurrentRevision($id);
269  $info = $rev->getInformation();
270  $info->setTitle($title);
271  $rev->setInformation($info);
272  $this->irss->manage()->updateRevision($rev);
273  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$info
Definition: entry_point.php:21
+ Here is the call graph for this function:

◆ stream()

ILIAS\Repository\IRSS\IRSSWrapper::stream ( string  $rid)

Definition at line 284 of file IRSSWrapper.php.

References $id, ILIAS\Repository\IRSS\IRSSWrapper\getResourceIdForIdString(), and null.

Referenced by ILIAS\Repository\IRSS\IRSSWrapper\getResourcePath(), ILIAS\Repository\IRSS\IRSSWrapper\getStreamOfContainerEntry(), and ILIAS\Repository\IRSS\IRSSWrapper\hasContainerEntry().

284  : ?FileStream
285  {
286  $id = $this->getResourceIdForIdString($rid);
287  if ($id) {
288  return $this->irss->consume()->stream($id)->getStream();
289  }
290  return null;
291  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $archives

Archives ILIAS\Repository\IRSS\IRSSWrapper::$archives
protected

Definition at line 47 of file IRSSWrapper.php.

◆ $file_delivery

ILIAS FileDelivery Services ILIAS\Repository\IRSS\IRSSWrapper::$file_delivery
protected

Definition at line 44 of file IRSSWrapper.php.

◆ $filesystems

ILIAS\Repository\IRSS\IRSSWrapper::$filesystems
protected

Definition at line 43 of file IRSSWrapper.php.

◆ $irss

ILIAS ResourceStorage Services ILIAS\Repository\IRSS\IRSSWrapper::$irss
protected

Definition at line 46 of file IRSSWrapper.php.

◆ $upload


The documentation for this class was generated from the following file: