65 public function __construct($a_storage_type, $a_path_conversion, $a_container_id)
67 $this->storage_type = $a_storage_type;
68 $this->path_conversion = $a_path_conversion;
69 $this->container_id = $a_container_id;
98 return $stream->getMetadata(
'uri');
110 return $DIC->filesystem()->storage();
114 return $DIC->filesystem()->web();
138 $num = $a_container_id;
140 for (
$i = self::MAX_EXPONENT;
$i > 0;
$i--) {
141 $factor = pow(self::FACTOR,
$i);
142 if (($tmp = (
int) ($num / $factor)) or $found) {
144 $num = $num % $factor;
150 $path_string = (implode(
'/',
$path) .
'/');
153 return $path_string . $a_name .
'_' . $a_container_id;
240 switch ($this->storage_type) {
252 if ($this->path_conversion) {
273 }
catch (Exception
$e) {
292 }
catch (Exception
$e) {
312 }
catch (Exception
$e) {
324 public function delete()
328 }
catch (Exception
$e) {
349 }
catch (Exception
$e) {
367 $sourceFS = LegacyPathHelper::deriveFilesystemFrom($a_sdir);
368 $targetFS = LegacyPathHelper::deriveFilesystemFrom($a_tdir);
370 $sourceDir = LegacyPathHelper::createRelativePath($a_sdir);
371 $targetDir = LegacyPathHelper::createRelativePath($a_tdir);
374 if (!$sourceFS->hasDir($sourceDir)) {
378 $sourceList = $sourceFS->listContents($sourceDir,
true);
380 foreach ($sourceList as $item) {
381 if ($item->isDir()) {
385 $itemPath = $targetDir .
'/' . substr($item->getPath(), strlen($sourceDir));
386 $stream = $sourceFS->readStream($sourceDir);
387 $targetFS->writeStream($itemPath, $stream);
391 }
catch (\Exception $exception) {
402 $this->path .= $a_appendix;
433 return $relative_path;
An exception for terminatinating execution or to throw for unit testing.
Class IOException Indicates general problems with the input or output operations.
Class LegacyPathHelper The legacy path helper provides convenient functions for the integration of th...
static createRelativePath(string $absolute_path)
Creates a relative path from an absolute path which starts with a valid storage location.
deleteDirectory($a_absolute_path)
deleteFile($a_absolute_path)
writeToFile($a_data, $a_absolute_path)
createRelativePathForFileSystem($a_absolute_path)
static _copyDirectory($a_sdir, $a_tdir)
getAbsolutePath()
Calculates the full path on the filesystem.
static _createPathFromId($a_container_id, $a_name)
Create a path from an id: e.g 12345 will be converted to 12/34/<name>_5.
fileExists($a_absolute_path)
create()
Create directory.
getLegacyFullAbsolutePath($relative_path)
appendToPath($a_appendix)
getLegacyAbsolutePath()
Calculates the absolute filesystem storage location.
__construct($a_storage_type, $a_path_conversion, $a_container_id)
Constructor.
getPathPrefix()
Get path prefix.
getPathPostfix()
Get directory name.