19 declare(strict_types=1);
67 $this->
filesystem->createDir($path, $visibility);
73 public function copyDir(
string $source,
string $destination): void
81 foreach ($contentList as $content) {
83 if ($content->isFile()) {
85 $position = strpos($content->getPath(), $source);
86 if ($position !==
false) {
87 $destinationFilePath = substr_replace(
93 $this->
copy($content->getPath(), $destinationFilePath);
136 return $this->
filesystem->getTimestamp($path);
156 $this->sanitizer->sanitize($path),
166 return $this->
filesystem->getVisibility($path);
182 $this->
filesystem->writeStream($this->sanitizer->sanitize($path), $stream);
190 $this->
filesystem->putStream($this->sanitizer->sanitize($path), $stream);
198 $this->
filesystem->updateStream($this->sanitizer->sanitize($path), $stream);
206 $this->
filesystem->write($this->sanitizer->sanitize($path), $content);
214 $this->
filesystem->update($this->sanitizer->sanitize($path), $new_content);
220 public function put(
string $path,
string $content): void
222 $this->
filesystem->put($this->sanitizer->sanitize($path), $content);
228 public function delete(
string $path):
void 238 return $this->
filesystem->readAndDelete($path);
248 $this->sanitizer->sanitize($new_path)
255 public function copy(
string $path,
string $copy_path): void
259 $this->sanitizer->sanitize($copy_path)
275 if ($destinationContent !== []) {
276 throw new IOException(
"Destination \"$path\" is not empty can not copy files.");
293 if (!$this->
hasDir($path)) {
createDir(string $path, string $visibility=Visibility::PUBLIC_ACCESS)
rename(string $path, string $new_path)
listContents(string $path='', bool $recursive=false)
__construct(private Filesystem $filesystem, private FilenameSanitizer $sanitizer)
putStream(string $path, FileStream $stream)
Indicates general problems with the input or output operations.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getSize(string $path, int $unit)
put(string $path, string $content)
This class provides the data size with additional information to remove the work to calculate the siz...
ensureEmptyDirectory(string $path)
Ensures that the given path does not exist or is empty.
readAndDelete(string $path)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
updateStream(string $path, FileStream $stream)
The filesystem white list decorator rewrites forbidden file endings and delegates the rest of the ope...
Indicates that the directory is missing or not found.
getMimeType(string $path)
getTimestamp(string $path)
copy(string $path, string $copy_path)
writeStream(string $path, FileStream $stream)
The filename sanitizer verifies and fixes file name endings.
getVisibility(string $path)
ensureDirectoryExistence(string $path)
Checks if the directory exists.
setVisibility(string $path, string $visibility)
update(string $path, string $new_content)
const PUBLIC_ACCESS
Public file visibility.
write(string $path, string $content)
The base interface for all filesystem streams.
copyDir(string $source, string $destination)