19 declare(strict_types=1);
44 public function __construct(array $handlers,
private string $base_dir)
47 $this->handlers[$handler->getID()] =
$handler;
48 if ($handler->isPrimary()) {
49 if ($this->primary !==
null) {
50 throw new \LogicException(
"Only one primary StorageHandler can exist");
55 if ($this->primary ===
null) {
56 throw new \LogicException(
"One primary StorageHandler must exist");
62 return $this->base_dir;
77 if (isset($this->handlers[$storage_id])) {
78 return $this->handlers[$storage_id];
81 throw new \LogicException(
"no StorageHandler for '$storage_id' available");
91 $internal_path = str_replace($this->
getBaseDir(),
"", $uri);
92 $internal_path = ltrim(str_replace(self::BASE_DIRECTORY,
"", $internal_path),
"/");
94 $fs_identifier = explode(
"/", $internal_path)[0];
96 $internal_path = str_replace($fs_identifier .
"/",
"", $internal_path);
99 $path_generator =
$handler->getPathGenerator();
101 $rid = $path_generator->getIdentificationFor($internal_path);
Class FileResourceHandler.
Interface StorageResource.
getRidForURI(string $uri)
getHandlerForStorageId(string $storage_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Class ResourceIdentification.
getHandlerForRevision(Revision $revision)
getHandlerForResource(StorableResource $resource)
__construct(array $handlers, private string $base_dir)
StorageHandlerFactory constructor.
Class StorageHandlerFactory.