3 declare(strict_types=1);
49 $this->
upload = $uploadService;
58 public function copy(
int $targetObjId): void
66 $this->webDirectory->copy(
69 '/(' . $this->config->getSubDirectoryPrefix() .
')(\d*)\/(.*)$/',
70 '${1}' . $targetObjId .
'/${3}',
81 public function delete():
void 83 if ($this->webDirectory->hasDir($this->getIconDirectory())) {
98 return $this->config->getSupportedFileExtensions();
107 if ($this->webDirectory->has($fileName)) {
108 $this->webDirectory->delete($fileName);
111 $this->webDirectory->copy($sourceFilePath, $fileName);
122 if ($this->webDirectory->has($fileName)) {
123 $this->webDirectory->delete($fileName);
126 if ($this->
upload->hasUploads()) {
127 if (!$this->
upload->hasBeenProcessed()) {
132 $result = array_values($this->
upload->getResults())[0];
133 if ($result->isOK()) {
134 $this->
upload->moveOneFileTo(
143 foreach ($this->config->getUploadPostProcessors() as $processor) {
144 $processor->process($fileName);
153 if ($this->webDirectory->has($fileName)) {
160 public function remove():
void 164 if ($this->webDirectory->has($fileName)) {
165 $this->webDirectory->delete($fileName);
178 if (!$this->webDirectory->has(dirname($iconDirectory))) {
179 $this->webDirectory->createDir(dirname($iconDirectory));
182 if (!$this->webDirectory->has($iconDirectory)) {
183 $this->webDirectory->createDir($iconDirectory);
189 return implode(DIRECTORY_SEPARATOR, [
190 $this->config->getBaseDirectory(),
191 $this->config->getSubDirectoryPrefix() . $this->
getObjId()
197 return self::ICON_BASENAME .
'.' . $this->config->getTargetFileExtension();
202 return implode(DIRECTORY_SEPARATOR, [
220 return implode(DIRECTORY_SEPARATOR, [
228 $target_dir = implode(DIRECTORY_SEPARATOR, [
static getWebspaceDir(string $mode="filesystem")
get webspace directory
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Filesystem $webDirectory, FileUpload $uploadService, ilCustomIconObjectConfiguration $config, int $objId)
createCustomIconDirectory()
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
persistIconState(string $fileName)
getSupportedFileExtensions()
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
saveFromSourceFile(string $sourceFilePath)
createFromImportDir(string $source_dir)
ilCustomIconObjectConfiguration $config
Class FlySystemFileAccessTest disabled disabled disabled.
static _deleteContainerSettings(int $a_id, string $a_keyword="", bool $a_keyword_like=false)
Class ilObjectCustomIconImpl TODO: Inject database persistence in future instead of using ...