19 declare(strict_types=1);
46 public function copy(
int $targetObjId): void
57 '/(' . $this->config->getSubDirectoryPrefix() .
')(\d*)\/(.*)$/',
58 '${1}' . $targetObjId .
'/${3}',
69 public function delete():
void 71 if ($this->
filesystem->hasDir($this->getIconDirectory())) {
86 return $this->config->getSupportedFileExtensions();
99 $this->
filesystem->copy($sourceFilePath, $fileName);
115 $this->
filesystem->setVisibility($relative_path,
'public');
118 foreach ($this->config->getUploadPostProcessors() as $processor) {
119 $processor->process($relative_path);
125 public function saveFromHttpRequest():
void 135 if ($this->
upload->hasUploads() && !$this->
upload->hasBeenProcessed()) {
139 $result = array_values($this->
upload->getResults())[0];
140 if ($result->isOK()) {
141 $this->
upload->moveOneFileTo(
150 foreach ($this->config->getUploadPostProcessors() as $processor) {
151 $processor->process($fileName);
167 public function remove():
void 185 if (!$this->
filesystem->has(dirname($iconDirectory))) {
186 $this->
filesystem->createDir(dirname($iconDirectory));
189 if (!$this->
filesystem->has($iconDirectory)) {
196 return implode(DIRECTORY_SEPARATOR, [
197 $this->config->getBaseDirectory(),
198 $this->config->getSubDirectoryPrefix() . $this->
getObjId()
204 return self::ICON_BASENAME .
'.' . $this->config->getTargetFileExtension();
209 return implode(DIRECTORY_SEPARATOR, [
227 return implode(DIRECTORY_SEPARATOR, [
235 $target_dir = implode(DIRECTORY_SEPARATOR, [
static getWebspaceDir(string $mode="filesystem")
get webspace directory
persistIconState(string $fileName)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
createFromImportDir(string $source_dir)
getSupportedFileExtensions()
saveFromSourceFile(string $sourceFilePath)
__construct(protected Filesystem $filesystem, protected FileUpload $upload, protected Configuration $config, protected int $objId)
createCustomIconDirectory()
static getDataDir()
get data directory (outside webspace)
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
saveFromTempFileName(string $tempfile_name)
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
static _deleteContainerSettings(int $a_id, string $a_keyword="", bool $a_keyword_like=false)
const WEB
The filesystem within the ilias web root.