ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLoggingErrorSettings.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 2016 Stefan Hecken, Extended GPL, see docs/LICENSE */
3 
10 {
11  protected $folder;
12  protected $mail;
13 
14  protected function __construct()
15  {
16  global $DIC;
17 
18  $ilIliasIniFile = $DIC['ilIliasIniFile'];
19  // temporary bugfix for global usage
20  if ($DIC->offsetExists('ini')) {
21  $ini = $DIC['ini'];
22  }
23 
24  $ilClientIniFile = null;
25  if (isset($DIC['ilClientIniFile'])) {
26  $ilClientIniFile = $DIC['ilClientIniFile'];
27  }
28 
29  //realy not nice but necessary to initalize logger at setup
30  //ilias_ini is named only as $ini in inc.setup_header.php
31  if (!$ilIliasIniFile) {
32  if (!$ini) {
33  throw new Exception("No ILIAS ini");
34  } else {
35  $this->ilias_ini = $ini;
36  }
37  } else {
38  $this->ilias_ini = $ilIliasIniFile;
39  }
40 
41  if ($ilClientIniFile !== null) {
42  $this->gClientIniFile = $ilClientIniFile;
43  }
44 
45  $this->folder = null;
46  $this->mail = null;
47 
48  $this->read();
49  }
50 
51  public static function getInstance()
52  {
53  return new ilLoggingErrorSettings();
54  }
55 
56  protected function setFolder($folder)
57  {
58  $this->folder = $folder;
59  }
60 
61  public function setMail($mail)
62  {
63  $this->mail = $mail;
64  }
65 
66  public function folder()
67  {
68  return $this->folder;
69  }
70 
71  public function mail()
72  {
73  return $this->mail;
74  }
75 
79  protected function read()
80  {
81  $this->setFolder($this->ilias_ini->readVariable("log", "error_path"));
82 
83  if ($this->gClientIniFile instanceof \ilIniFile) {
84  $this->setMail($this->gClientIniFile->readVariable("log", "error_recipient"));
85  }
86  }
87 
91  public function update()
92  {
93  if ($this->gClientIniFile instanceof \ilIniFile) {
94  $this->gClientIniFile->addGroup("log");
95  $this->gClientIniFile->setVariable("log", "error_recipient", trim($this->mail()));
96  $this->gClientIniFile->write();
97  }
98  }
99 }
Settings for the error protcoll system.
update()
writes mail recipient into client.ini.php
global $DIC
Definition: saml.php:7
read()
reads the values from ilias.ini.php
$ilIliasIniFile
INIFile Parser.
$ini
Definition: raiseError.php:4