ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLogComponentLevels.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
29{
30 protected static ?ilLogComponentLevels $instance = null;
34 protected array $components = array();
35
36 protected ilDBInterface $db;
37
41 protected function __construct()
42 {
43 global $DIC;
44 $this->db = $DIC->database();
45 $this->read();
46 }
47
48 public static function getInstance(): ilLogComponentLevels
49 {
50 if (!self::$instance) {
51 self::$instance = new self();
52 }
53 return self::$instance;
54 }
55
59 public static function updateFromXML($a_component_id): bool
60 {
61 global $DIC;
62
63 $ilDB = $DIC->database();
64 if (!$a_component_id) {
65 return false;
66 }
67
68 $query = 'SELECT * FROM log_components ' .
69 'WHERE component_id = ' . $ilDB->quote($a_component_id, 'text');
70 $res = $ilDB->query($query);
71 if (!$res->numRows()) {
72 $query = 'INSERT INTO log_components (component_id) ' .
73 'VALUES (' .
74 $ilDB->quote($a_component_id, 'text') .
75 ')';
76 $ilDB->manipulate($query);
77 }
78 return true;
79 }
80
85 public function getLogComponents(): array
86 {
87 return $this->components;
88 }
89
90 public function read(): void
91 {
92 $query = 'SELECT * FROM log_components ';
93 $res = $this->db->query($query);
94
95 $this->components = array();
96 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
97 $this->components[] = new ilLogComponentLevel((string) $row->component_id, (int) $row->log_level);
98 }
99 }
100}
individual log levels for components
individual log levels for components
static updateFromXML($a_component_id)
static ilLogComponentLevels $instance
getLogComponents()
Get component levels.
Interface ilDBInterface.
$res
Definition: ltiservices.php:69
Class ilChatroomConfigFileHandler \ILIAS\Chatroom\classes.
global $DIC
Definition: shib_login.php:26