50     public function __construct(
int $a_storage_type, 
bool $a_path_conversion, 
int $a_container_id)
    53         $this->storage_type = $a_storage_type;
    54         $this->path_conversion = $a_path_conversion;
    55         $this->container_id = $a_container_id;
    56         $this->file_system_service = $DIC->filesystem();
    62     public function fileExists(
string $a_absolute_path): bool
    71         return $stream->getMetadata(
'uri');
    77             case self::STORAGE_DATA:
    78                 return $this->file_system_service->storage();
    79             case self::STORAGE_WEB:
    80             case self::STORAGE_SECURED:
    81             case self::SECURED_DIRECTORY:
    82                 return $this->file_system_service->web();
    96         $num = $a_container_id;
    98         for ($i = self::MAX_EXPONENT; $i > 0; $i--) {
    99             $factor = pow(self::FACTOR, $i);
   100             if (($tmp = (
int) ($num / $factor)) or $found) {
   102                 $num = $num % $factor;
   108             $path_string = (implode(
'/', $path) . 
'/');
   111         return $path_string . $a_name . 
'_' . $a_container_id;
   119         if (!$fp = @fopen($a_absolute_path, 
'w+')) {
   122         if (@fwrite($fp, $a_data) === 
false) {
   133     public function copyFile(
string $a_from, 
string $a_to): bool
   135         if (@file_exists($a_from)) {
   136             @copy($a_from, $a_to);
   192         return rtrim(
CLIENT_WEB_DIR, 
'/') . 
'/' . ltrim($this->path, 
'/');
   195     protected function init(): bool
   197         switch ($this->storage_type) {
   198             case self::STORAGE_DATA:
   199             case self::STORAGE_WEB:
   201             case self::STORAGE_SECURED:
   202                 $this->path = rtrim($this->path ?? 
'', 
'/') . 
'/' . self::SECURED_DIRECTORY . 
'/';
   209         if ($this->path_conversion) {
   210             $this->path .= self::createPathFromId($this->container_id, $this->
getPathPostfix());
   218     public function delete(): 
bool   246             $sourceFS = LegacyPathHelper::deriveFilesystemFrom($a_sdir);
   247             $targetFS = LegacyPathHelper::deriveFilesystemFrom($a_tdir);
   249             $sourceDir = LegacyPathHelper::createRelativePath($a_sdir);
   250             $targetDir = LegacyPathHelper::createRelativePath($a_tdir);
   253             if (!$sourceFS->hasDir($sourceDir)) {
   257             $sourceList = $sourceFS->listContents($sourceDir, 
true);
   259             foreach ($sourceList as $item) {
   260                 if ($item->isDir()) {
   264                 $itemPath = $targetDir . 
'/' . substr($item->getPath(), strlen($sourceDir));
   265                 $stream = $sourceFS->readStream($sourceDir);
   266                 $targetFS->writeStream($itemPath, $stream);
   277         $this->path .= $a_appendix;
   294         return $relative_path;
 getPathPostfix()
Get directory name. 
 
static createRelativePath(string $absolute_path)
Creates a relative path from an absolute path which starts with a valid storage location. 
 
appendToPath(string $a_appendix)
 
deleteDirectory(string $a_abs_name)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
createRelativePathForFileSystem(string $a_absolute_path)
 
__construct(int $a_storage_type, bool $a_path_conversion, int $a_container_id)
Constructor. 
 
fileExists(string $a_absolute_path)
 
getPathPrefix()
Get path prefix. 
 
static createPathFromId(int $a_container_id, string $a_name)
 
copyFile(string $a_from, string $a_to)
 
getLegacyAbsolutePath()
Calculates the absolute filesystem storage location. 
 
getAbsolutePath()
Calculates the full path on the filesystem. 
 
writeToFile(string $a_data, $a_absolute_path)
 
getLegacyFullAbsolutePath(string $relative_path)
 
static _copyDirectory(string $a_sdir, string $a_tdir)
 
ILIAS Filesystem Filesystems $file_system_service
 
deleteFile(string $a_abs_name)