ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $ilIliasIniFile, $ini, $ilClientIniFile;
17 
18  //realy not nice but necessary to initalize logger at setup
19  //ilias_ini is named only as $ini in inc.setup_header.php
20  if (!$ilIliasIniFile) {
21  if (!$ini) {
22  throw new Exception("No ILIAS ini");
23  } else {
24  $this->ilias_ini = $ini;
25  }
26  } else {
27  $this->ilias_ini = $ilIliasIniFile;
28  }
29 
30  if ($ilClientIniFile !== null) {
31  $this->gClientIniFile = $ilClientIniFile;
32  }
33 
34  $this->folder = null;
35  $this->mail = null;
36 
37  $this->read();
38  }
39 
40  public static function getInstance()
41  {
42  return new ilLoggingErrorSettings();
43  }
44 
45  protected function setFolder($folder)
46  {
47  $this->folder = $folder;
48  }
49 
50  public function setMail($mail)
51  {
52  $this->mail = $mail;
53  }
54 
55  public function folder()
56  {
57  return $this->folder;
58  }
59 
60  public function mail()
61  {
62  return $this->mail;
63  }
64 
68  protected function read()
69  {
70  $this->setFolder($this->ilias_ini->readVariable("log", "error_path"));
71 
72  if ($this->gClientIniFile instanceof \ilIniFile) {
73  $this->setMail($this->gClientIniFile->readVariable("log", "error_recipient"));
74  }
75  }
76 
80  public function update()
81  {
82  if ($this->gClientIniFile instanceof \ilIniFile) {
83  $this->gClientIniFile->addGroup("log");
84  $this->gClientIniFile->setVariable("log", "error_recipient", trim($this->mail()));
85  $this->gClientIniFile->write();
86  }
87  }
88 }
Settings for the error protcoll system.
update()
writes mail recipient into client.ini.php
read()
reads the values from ilias.ini.php
$ilIliasIniFile
INIFile Parser.
$ini
Definition: raiseError.php:4