80 string $clientID = CLIENT_ID
85 $this->logger = $logger;
99 if (null === $certificateFileUtilsHelper) {
102 $this->fileUtilsHelper = $certificateFileUtilsHelper;
109 $this->clientId = $clientID;
129 if (!$this->fileSystem->hasDir($imagepath)) {
135 $this->uploadFile($imageTempFilename, $backgroundImageTempFilePath);
137 $backgroundImagePath = $this->certificatePath .
'background_' . $version .
'.jpg';
139 $this->utilHelper->convertImage(
140 $backgroundImageTempFilePath,
141 $this->rootDirectory . $backgroundImagePath,
147 $this->utilHelper->convertImage(
148 $backgroundImageTempFilePath,
149 $backgroundImageThumbnailPath,
154 $convert_filename = self::BACKGROUND_IMAGE_NAME;
156 if (!$this->fileSystem->has($backgroundImagePath)) {
158 if (!ilUtil::moveUploadedFile($backgroundImageTempFilePath, $convert_filename, $this->rootDirectory . $backgroundImagePath)) {
159 throw new ilException(
'Unable to convert the file and the original file');
163 $this->fileSystem->delete($this->certificatePath . self::BACKGROUND_TEMPORARY_FILENAME);
165 if ($this->fileSystem->has($backgroundImagePath)) {
166 return $this->certificatePath .
'background_' . $version .
'.jpg';
169 throw new ilException(
'The given temporary filename is empty');
179 private function uploadFile(
string $temporaryFilename,
string $targetFileName)
181 $targetFilename = basename($targetFileName);
182 $targetFilename = $this->fileUtilsHelper->getValidFilename($targetFilename);
187 if (
false === $this->fileUpload->hasBeenProcessed()) {
188 $this->fileUpload->process();
191 if (
false === $this->fileUpload->hasUploads()) {
198 $uploadResults = $this->fileUpload->getResults();
199 $uploadResult = $uploadResults[$temporaryFilename];
201 $processingStatus = $uploadResult->getStatus();
203 throw new ilException($processingStatus->getMessage());
206 $this->fileUpload->moveOneFileTo(
222 case strpos($target, $this->rootDirectory .
'/' . $this->clientId) === 0:
223 case strpos($target,
'./' . $this->rootDirectory .
'/' . $this->clientId) === 0:
224 case strpos($target, $this->rootDirectory) === 0:
227 case strpos($target, CLIENT_DATA_DIR .
"/temp") === 0:
230 case strpos($target, CLIENT_DATA_DIR) === 0:
233 case strpos($target, ILIAS_ABSOLUTE_PATH .
'/Customizing') === 0:
237 throw new InvalidArgumentException(
"Can not move files to \"$target\" because path can not be mapped to web, storage or customizing location.");
240 return $targetFilesystem;
249 $absTargetDir = dirname($target);
250 $targetDir = $this->legacyPathHelper->createRelativePath($absTargetDir);
262 return $this->rootDirectory . $this->certificatePath . self::BACKGROUND_TEMPORARY_FILENAME;
272 return $this->rootDirectory . $this->certificatePath . self::BACKGROUND_THUMBNAIL_IMAGE_NAME;
static makeDirParents($a_dir)
Create a new directory and all parent directories.
const REJECTED
Upload got rejected by a processor.
const STORAGE
The filesystem outside of the ilias web root.
getTargetFilesystem(string $target)
uploadBackgroundImage(string $imageTempFilename, int $version)
Uploads a background image for the certificate.
const BACKGROUND_TEMPORARY_FILENAME
const BACKGROUND_IMAGE_NAME
const CUSTOMIZING
The filesystem within the web root where all the skins and plugins are saved.
getTargetDir(string $target)
createBackgroundImageTempfilePath()
Returns the filesystem path of the background image temp file during upload.
Just a wrapper class to create Unit Test for other classes.
const TEMPORARY
The ILIAS temporary directory.
const BACKGROUND_THUMBNAIL_IMAGE_NAME
createBackgroundImageThumbPath()
Returns the filesystem path of the background image thumbnail.
Component logger with individual log levels by component id.
Class FlySystemFileAccessTest.
__construct(\ILIAS\FileUpload\FileUpload $fileUpload, string $certificatePath, ilLanguage $language, ilLogger $logger, \ILIAS\Filesystem\Filesystem $fileSystem=null, ilCertificateUtilHelper $utilHelper=null, ilCertificateFileUtilsHelper $certificateFileUtilsHelper=null, LegacyPathHelperHelper $legacyPathHelper=null, string $rootDirectory=CLIENT_WEB_DIR, string $clientID=CLIENT_ID)
const WEB
The filesystem within the ilias web root.