ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDatabaseMetricsCollectedObjective Class Reference
+ Inheritance diagram for ilDatabaseMetricsCollectedObjective:
+ Collaboration diagram for ilDatabaseMetricsCollectedObjective:

Protected Member Functions

 getTentativePreconditions (Setup\Environment $environment)
 
 collectFrom (Setup\Environment $environment, Setup\Metrics\Storage $storage)
 

Detailed Description

Member Function Documentation

◆ collectFrom()

ilDatabaseMetricsCollectedObjective::collectFrom ( Setup\Environment  $environment,
Setup\Metrics\Storage  $storage 
)
protected

PhpArrayIndexImmediatelyRewrittenInspection

Definition at line 37 of file class.ilDatabaseMetricsCollectedObjective.php.

References $client_id, $DIC, $GLOBALS, $ini, and ILIAS\UI\examples\MessageBox\Info\info().

37  : void
38  {
39  $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
40  if ($client_ini) {
41  $storage->storeConfigText(
42  "type",
43  $client_ini->readVariable("db", "type") ?? "mysql",
44  "The storage backend that is used for the database."
45  );
46  $storage->storeConfigText(
47  "host",
48  $client_ini->readVariable("db", "host"),
49  "The host where the storage backend is located."
50  );
51  $storage->storeConfigText(
52  "port",
53  $client_ini->readVariable("db", "port"),
54  "The port where the storage backend is located at the host."
55  );
56  $storage->storeConfigText(
57  "name",
58  $client_ini->readVariable("db", "name"),
59  "The name of the database in the storage backend."
60  );
61  $storage->storeConfigText(
62  "user",
63  $client_ini->readVariable("db", "user"),
64  "The user to be used for the storage backend."
65  );
66  $storage->storeConfigText(
67  "pass",
68  PHP_SAPI === 'cli' ? $client_ini->readVariable("db", "pass") : '********',
69  "The password for the user for the storage backend."
70  );
71  }
72 
73 
74  $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
75  $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
76  if (!$db && !$ini) {
77  return;
78  }
79  $client_id = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_ID);
80 
81  // ATTENTION: This is a total abomination. It only exists to allow the db-
82  // update to run. This is a memento to the fact, that dependency injection
83  // is something we want. Currently, every component could just service
84  // locate the whole world via the global $DIC.
85  $DIC = $GLOBALS["DIC"] ?? [];
86  $GLOBALS["DIC"] = new DI\Container();
87  $GLOBALS["DIC"]["ilDB"] = $db;
88  $GLOBALS["ilDB"] = $db;
89  $GLOBALS["DIC"]["ilBench"] = null;
90  $GLOBALS["DIC"]["ilLog"] = new class () {
91  public function write(): void
92  {
93  }
94  public function info(): void
95  {
96  }
97  public function warning($msg): void
98  {
99  }
100  public function error($msg): void
101  {
102  }
103  };
104  $GLOBALS["ilLog"] = $GLOBALS["DIC"]["ilLog"];
106  $GLOBALS["DIC"]["ilLoggerFactory"] = new class () {
107  public function getRootLogger(): object
108  {
109  return new class () {
110  public function write(): void
111  {
112  }
113  };
114  }
115  };
116  $GLOBALS["ilCtrlStructureReader"] = new class () {
117  public function getStructure(): void
118  {
119  }
120  public function setIniFile(): void
121  {
122  }
123  };
124  if (!defined("CLIENT_DATA_DIR")) {
125  define("CLIENT_DATA_DIR", $ini->readVariable("clients", "datadir") . "/" . $client_id);
126  }
127  if (!defined("CLIENT_WEB_DIR")) {
128  define("CLIENT_WEB_DIR", dirname(__DIR__, 4) . "/data/" . $client_id);
129  }
130  if (!defined("ILIAS_ABSOLUTE_PATH")) {
131  define("ILIAS_ABSOLUTE_PATH", dirname(__FILE__, 5));
132  }
133  if (!defined("ILIAS_LOG_ENABLED")) {
134  define("ILIAS_LOG_ENABLED", false);
135  }
136  if (!defined("ROOT_FOLDER_ID")) {
137  define("ROOT_FOLDER_ID", (int) $client_ini->readVariable("system", "ROOT_FOLDER_ID"));
138  }
139  if (!defined("ROLE_FOLDER_ID")) {
140  define("ROLE_FOLDER_ID", (int) $client_ini->readVariable("system", "ROLE_FOLDER_ID"));
141  }
142  if (!defined("SYSTEM_FOLDER_ID")) {
143  define("SYSTEM_FOLDER_ID", (int) $client_ini->readVariable("system", "SYSTEM_FOLDER_ID"));
144  }
145 
146  $db_update = new ilDBUpdate($db);
147  $db_update->readCustomUpdatesInfo(true);
148 
149  $storage->storeStableCounter(
150  "version",
151  $db_update->getCurrentVersion(),
152  "The version of the database schema that is currently installed."
153  );
154  $storage->storeStableCounter(
155  "available_version",
156  $db_update->getFileVersion(),
157  "The version of the database schema that is available in the current source."
158  );
159  $storage->storeStableBool(
160  "update_required",
161  !$db_update->getDBVersionStatus(),
162  "Does the database require an update?"
163  );
164  $storage->storeStableCounter(
165  "hotfix_version",
166  $db_update->getHotfixCurrentVersion() ?? 0,
167  "The version of the hotfix database schema that is currently installed."
168  );
169  $storage->storeStableCounter(
170  "available_hotfix_version",
171  $db_update->getHotfixFileVersion() ?? 0,
172  "The version of the hotfix database schema that is available in the current source."
173  );
174  $storage->storeStableBool(
175  "hotfix_required",
176  $db_update->hotfixAvailable(),
177  "Does the database require a hotfix update?"
178  );
179  $storage->storeStableCounter(
180  "custom_version",
181  $db_update->getCustomUpdatesCurrentVersion() ?? 0,
182  "The version of the custom database schema that is currently installed."
183  );
184  $storage->storeStableCounter(
185  "available_custom_version",
186  $db_update->getCustomUpdatesFileVersion() ?? 0,
187  "The version of the custom database schema that is available in the current source."
188  );
189  $storage->storeStableBool(
190  "custom_update_required",
191  $db_update->customUpdatesAvailable(),
192  "Does the database require a custom update?"
193  );
194 
195  $GLOBALS["DIC"] = $DIC;
196  }
global $DIC
Definition: feed.php:28
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$client_id
Definition: ltiauth.php:68
$ini
Definition: raiseError.php:4
+ Here is the call graph for this function:

◆ getTentativePreconditions()

ilDatabaseMetricsCollectedObjective::getTentativePreconditions ( Setup\Environment  $environment)
protected
Returns
array<|>

Definition at line 29 of file class.ilDatabaseMetricsCollectedObjective.php.

29  : array
30  {
31  return [
32  new \ilIniFilesLoadedObjective(),
33  new \ilDatabaseInitializedObjective()
34  ];
35  }

The documentation for this class was generated from the following file: