ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLoggingErrorSettings.php
Go to the documentation of this file.
1<?php
2
25{
26 protected string $folder = '';
27 protected string $mail = '';
28 protected ?ilIniFile $ilias_ini = null;
29 protected ?ilIniFile $gClientIniFile = null;
30
31 protected function __construct()
32 {
33 global $DIC;
34
35 if ($DIC->offsetExists('ilIliasIniFile')) {
36 $this->ilias_ini = $DIC->iliasIni();
37 } elseif ($DIC->offsetExists('ini')) {
38 $this->ilias_ini = $DIC['ini'];
39 }
40 if ($DIC->offsetExists('ilClientIniFile')) {
41 $this->gClientIniFile = $DIC->clientIni();
42 }
43 $this->read();
44 }
45
46 public static function getInstance(): ilLoggingErrorSettings
47 {
48 return new ilLoggingErrorSettings();
49 }
50
51 protected function setFolder(string $folder): void
52 {
53 $this->folder = $folder;
54 }
55
56 public function setMail(string $mail): void
57 {
58 $this->mail = $mail;
59 }
60
61 public function folder(): string
62 {
63 return $this->folder;
64 }
65
66 public function mail(): string
67 {
68 return $this->mail;
69 }
70
74 protected function read(): void
75 {
76 if ($this->ilias_ini instanceof ilIniFile) {
77 $this->setFolder((string) $this->ilias_ini->readVariable("log", "error_path"));
78 }
79 if ($this->gClientIniFile instanceof \ilIniFile) {
80 $this->setMail((string) $this->gClientIniFile->readVariable("log", "error_recipient"));
81 }
82 }
83
87 public function update(): void
88 {
89 if ($this->gClientIniFile instanceof \ilIniFile) {
90 $this->gClientIniFile->addGroup("log");
91 $this->gClientIniFile->setVariable("log", "error_recipient", trim($this->mail()));
92 $this->gClientIniFile->write();
93 }
94 }
95}
INIFile Parser Early access in init proceess! Avoid further dependencies like logging or other servic...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
read()
reads the values from ilias.ini.php
update()
writes mail recipient into client.ini.php
global $DIC
Definition: shib_login.php:26