ILIAS  release_8 Revision v8.24
class.ilLogComponentLevels.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
6
7
8
17{
18 protected static ?ilLogComponentLevels $instance = null;
22 protected array $components = array();
23
24 protected ilDBInterface $db;
25
29 protected function __construct()
30 {
31 global $DIC;
32 $this->db = $DIC->database();
33 $this->read();
34 }
35
36 public static function getInstance(): ilLogComponentLevels
37 {
38 if (!self::$instance) {
39 self::$instance = new self();
40 }
41 return self::$instance;
42 }
43
47 public static function updateFromXML($a_component_id): bool
48 {
49 global $DIC;
50
51 $ilDB = $DIC->database();
52 if (!$a_component_id) {
53 return false;
54 }
55
56 $query = 'SELECT * FROM log_components ' .
57 'WHERE component_id = ' . $ilDB->quote($a_component_id, 'text');
58 $res = $ilDB->query($query);
59 if (!$res->numRows()) {
60 $query = 'INSERT INTO log_components (component_id) ' .
61 'VALUES (' .
62 $ilDB->quote($a_component_id, 'text') .
63 ')';
64 $ilDB->manipulate($query);
65 }
66 return true;
67 }
68
73 public function getLogComponents(): array
74 {
75 return $this->components;
76 }
77
78 public function read(): void
79 {
80 $query = 'SELECT * FROM log_components ';
81 $res = $this->db->query($query);
82
83 $this->components = array();
84 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
85 $this->components[] = new ilLogComponentLevel((string) $row->component_id, (int) $row->log_level);
86 }
87 }
88}
individual log levels for components
individual log levels for components
static updateFromXML($a_component_id)
static ilLogComponentLevels $instance
getLogComponents()
Get component levels.
global $DIC
Definition: feed.php:28
Interface ilDBInterface.
$res
Definition: ltiservices.php:69
$query