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