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,
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();
210 if ($processingStatus->getCode() ===
ILIAS\FileUpload\DTO\ProcessingStatus::REJECTED) {
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);
An exception for terminatinating execution or to throw for unit testing.
Class EntryLockingStringMap.
getTargetDir(string $target)
const BACKGROUND_IMAGE_NAME
__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)
const BACKGROUND_TEMPORARY_FILENAME
uploadBackgroundImage(string $imageTempFilename, int $version, ?array $pending_file=null)
Uploads a background image for the certificate.
const BACKGROUND_THUMBNAIL_IMAGE_NAME
getTargetFilesystem(string $target)
createBackgroundImageThumbPath()
Returns the filesystem path of the background image thumbnail.
createBackgroundImageTempfilePath()
Returns the filesystem path of the background image temp file during upload.
Just a wrapper class to create Unit Test for other classes.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Component logger with individual log levels by component id.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static makeDirParents($a_dir)
Create a new directory and all parent directories.
const TEMPORARY
The ILIAS temporary directory.
const CUSTOMIZING
The filesystem within the web root where all the skins and plugins are saved.
const WEB
The filesystem within the ilias web root.
const STORAGE
The filesystem outside of the ilias web root.
Class FlySystemFileAccessTest \Provider\FlySystem @runTestsInSeparateProcesses @preserveGlobalState d...
Class ChatMainBarProvider \MainMenu\Provider.