99 if (null === $certificateFileUtilsHelper) {
102 $this->fileUtilsHelper = $certificateFileUtilsHelper;
109 $this->clientId = $clientID;
136 if (!$this->fileSystem->hasDir($imagepath)) {
142 $this->uploadFile($imageTempFilename, $backgroundImageTempFilePath, $pending_file);
144 $backgroundImagePath = $this->certificatePath .
'background_' . $version .
'.jpg';
146 $this->utilHelper->convertImage(
147 $backgroundImageTempFilePath,
148 $this->rootDirectory . $backgroundImagePath,
154 $this->utilHelper->convertImage(
155 $backgroundImageTempFilePath,
156 $backgroundImageThumbnailPath,
161 $convert_filename = self::BACKGROUND_IMAGE_NAME;
163 if (!$this->fileSystem->has($backgroundImagePath)) {
165 if (!
ilUtil::moveUploadedFile($backgroundImageTempFilePath, $convert_filename, $this->rootDirectory . $backgroundImagePath)) {
166 throw new ilException(
'Unable to convert the file and the original file');
170 $this->fileSystem->delete($this->certificatePath . self::BACKGROUND_TEMPORARY_FILENAME);
172 if ($this->fileSystem->has($backgroundImagePath)) {
173 return $this->certificatePath .
'background_' . $version .
'.jpg';
176 throw new ilException(
'The given temporary filename is empty');
187 private function uploadFile(
string $temporaryFilename,
string $targetFileName, ?array $pending_file = null)
189 $targetFilename = basename($targetFileName);
190 $targetFilename = $this->fileUtilsHelper->getValidFilename($targetFilename);
195 if (
false === $this->fileUpload->hasBeenProcessed()) {
196 $this->fileUpload->process();
199 if (
false === $this->fileUpload->hasUploads()) {
206 $uploadResults = $this->fileUpload->getResults();
207 if (isset($uploadResults[$temporaryFilename])) {
208 $uploadResult = $uploadResults[$temporaryFilename];
209 $processingStatus = $uploadResult->getStatus();
211 throw new ilException($processingStatus->getMessage());
214 $this->fileUpload->moveOneFileTo(
221 } elseif ($pending_file !== null && !empty($pending_file)) {
222 $stream = $this->tmp_file_system->readStream(basename($pending_file[
'tmp_name']));
223 $this->fileSystem->writeStream($targetDir .
'/' . $targetFilename, $stream);
236 case strpos($target, $this->rootDirectory .
'/' . $this->clientId) === 0:
237 case strpos($target,
'./' . $this->rootDirectory .
'/' . $this->clientId) === 0:
238 case strpos($target, $this->rootDirectory) === 0:
247 case strpos($target, ILIAS_ABSOLUTE_PATH .
'/Customizing') === 0:
251 throw new InvalidArgumentException(
"Can not move files to \"$target\" because path can not be mapped to web, storage or customizing location.");
254 return $targetFilesystem;
263 $absTargetDir = dirname($target);
264 $targetDir = $this->legacyPathHelper->createRelativePath($absTargetDir);
276 return $this->rootDirectory . $this->certificatePath . self::BACKGROUND_TEMPORARY_FILENAME;
286 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)
Class ChatMainBarProvider .
const BACKGROUND_TEMPORARY_FILENAME
__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, \ILIAS\Filesystem\Filesystem $tmp_file_system=null)
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
const BACKGROUND_IMAGE_NAME
const CUSTOMIZING
The filesystem within the web root where all the skins and plugins are saved.
getTargetDir(string $target)
uploadBackgroundImage(string $imageTempFilename, int $version, ?array $pending_file=null)
Uploads a background image for the certificate.
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 disabled disabled disabled.
const WEB
The filesystem within the ilias web root.