ILIAS  release_8 Revision v8.24
classs.ilCertificateBackgroundImageDelete.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
26 private string $certificatePath;
28
30 {
31 $this->certificatePath = $certificatePath;
32 $this->fileService = $fileService;
33 }
34
35 public function deleteBackgroundImage(?int $version): void
36 {
37 if (is_file($this->fileService->getBackgroundImageThumbPath())) {
38 unlink($this->fileService->getBackgroundImageThumbPath());
39 }
40
41 $version_string = '';
42 if (is_int($version) && $version >= 0) {
43 $version_string = (string) $version;
44 }
45
46 $filename = $this->certificatePath . 'background_' . $version_string . '.jpg';
47 if (is_file($filename)) {
48 unlink($filename);
49 }
50
51 foreach ($this->fileService->getValidBackgroundImageFileExtensions() as $extension) {
52 if (file_exists($this->fileService->getBackgroundImageTempfilePath($extension))) {
53 unlink($this->fileService->getBackgroundImageTempfilePath($extension));
54 }
55 }
56 }
57}
$version
Definition: plugin.php:24
$filename
Definition: buildRTE.php:78
__construct(string $certificatePath, ilCertificateBackgroundImageFileService $fileService)
ilCertificateBackgroundImageFileService $fileService