39 $this->upload = $uploadService;
54 public function copy(
int $targetObjId)
62 $this->webDirectory->copy(
65 '/(' . $this->config->getSubDirectoryPrefix() .
')(\d*)\/(.*)$/',
66 '${1}' . $targetObjId .
'/${3}',
80 public function delete()
82 if ($this->webDirectory->hasDir($this->getIconDirectory())) {
97 return $this->config->getSupportedFileExtensions();
109 if ($this->webDirectory->has($fileName)) {
110 $this->webDirectory->delete($fileName);
113 $this->webDirectory->copy($sourceFilePath, $fileName);
127 if ($this->webDirectory->has($fileName)) {
128 $this->webDirectory->delete($fileName);
131 if ($this->upload->hasUploads() && !$this->upload->hasBeenProcessed()) {
132 $this->upload->process();
135 $result = array_values($this->upload->getResults())[0];
137 $this->upload->moveOneFileTo(
146 foreach ($this->config->getUploadPostProcessors() as $processor) {
147 $processor->process($fileName);
159 if ($this->webDirectory->has($fileName)) {
169 public function remove()
173 if ($this->webDirectory->has($fileName)) {
174 $this->webDirectory->delete($fileName);
187 if (!$this->webDirectory->has(dirname($iconDirectory))) {
188 $this->webDirectory->createDir(dirname($iconDirectory));
191 if (!$this->webDirectory->has($iconDirectory)) {
192 $this->webDirectory->createDir($iconDirectory);
201 return implode(DIRECTORY_SEPARATOR, [
202 $this->config->getBaseDirectory(),
203 $this->config->getSubDirectoryPrefix() . $this->
getObjId()
212 return self::ICON_BASENAME .
'.' . $this->config->getTargetFileExtension();
220 return implode(DIRECTORY_SEPARATOR, [
244 return implode(DIRECTORY_SEPARATOR, [
259 $target_dir = implode(DIRECTORY_SEPARATOR, [
createFromImportDir($source_dir)
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
createCustomIconDirectory()
persistIconState(string $fileName)
static _deleteContainerSettings($a_id, $a_keyword=null, $a_keyword_like=false)
getSupportedFileExtensions()
Interface ilObjectCustomIcon.
static _writeContainerSetting($a_id, $a_keyword, $a_value)
saveFromSourceFile(string $sourceFilePath)
static getWebspaceDir($mode="filesystem")
get webspace directory
__construct(Filesystem $webDirectory, FileUpload $uploadService, \ilCustomIconObjectConfiguration $config, int $objId)
ilObjectCustomIconImpl constructor.
Class FlySystemFileAccessTest.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
Class ilObjectCustomIconImpl TODO: Inject database persistence in future instead of using ...