ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDatabaseMetricsCollectedObjective Class Reference
+ Inheritance diagram for ilDatabaseMetricsCollectedObjective:
+ Collaboration diagram for ilDatabaseMetricsCollectedObjective:

Protected Member Functions

 getTentativePreconditions (Environment $environment)
 
 collectFrom (Environment $environment, Storage $storage)
 
- Protected Member Functions inherited from ILIAS\Setup\Metrics\CollectedObjective
 collectFrom (Setup\Environment $environment, Storage $storage)
 Attempt to gather metrics based on the provided environment. More...
 
 getTentativePreconditions (Setup\Environment $environment)
 Give preconditions that might or might not be fullfilled. More...
 

Additional Inherited Members

- Public Member Functions inherited from ILIAS\Setup\Metrics\CollectedObjective
 __construct (Storage $storage)
 
 getHash ()
 Get a hash for this objective. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 
- Public Member Functions inherited from ILIAS\Setup\Objective
 getHash ()
 Get a hash for this objective. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 getPreconditions (Environment $environment)
 Objectives might depend on other objectives. More...
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 Get to know whether the objective is applicable. More...
 
- Protected Attributes inherited from ILIAS\Setup\Metrics\CollectedObjective
Storage $storage
 

Detailed Description

Member Function Documentation

◆ collectFrom()

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

@noinspection PhpArrayIndexImmediatelyRewrittenInspection

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

39 : void
40 {
41 $client_ini = $environment->getResource(Environment::RESOURCE_CLIENT_INI);
42 if ($client_ini) {
44 "type",
45 $client_ini->readVariable("db", "type") ?? "mysql",
46 "The storage backend that is used for the database."
47 );
49 "host",
50 $client_ini->readVariable("db", "host"),
51 "The host where the storage backend is located."
52 );
54 "port",
55 $client_ini->readVariable("db", "port"),
56 "The port where the storage backend is located at the host."
57 );
59 "name",
60 $client_ini->readVariable("db", "name"),
61 "The name of the database in the storage backend."
62 );
64 "user",
65 $client_ini->readVariable("db", "user"),
66 "The user to be used for the storage backend."
67 );
69 "pass",
70 PHP_SAPI === 'cli' ? $client_ini->readVariable("db", "pass") : '********',
71 "The password for the user for the storage backend."
72 );
73 }
74
75
76 $db = $environment->getResource(Environment::RESOURCE_DATABASE);
77 $ini = $environment->getResource(Environment::RESOURCE_ILIAS_INI);
78 if (!$db && !$ini) {
79 return;
80 }
81 $client_id = $environment->getResource(Environment::RESOURCE_CLIENT_ID);
82
83 // ATTENTION: This is a total abomination. It only exists to allow the db-
84 // update to run. This is a memento to the fact, that dependency injection
85 // is something we want. Currently, every component could just service
86 // locate the whole world via the global $DIC.
87 $DIC = $GLOBALS["DIC"] ?? [];
88 try {
89 $GLOBALS["DIC"] = new Container();
90 $GLOBALS["DIC"]["ilDB"] = $db;
91 $GLOBALS["DIC"]["ilBench"] = null;
92 $GLOBALS["DIC"]["ilLog"] = new class () {
93 public function write(): void
94 {
95 }
96 public function info(): void
97 {
98 }
99 public function warning($msg): void
100 {
101 }
102 public function error($msg): void
103 {
104 }
105 };
107 $GLOBALS["DIC"]["ilLoggerFactory"] = new class () {
108 public function getRootLogger(): object
109 {
110 return new class () {
111 public function write(): void
112 {
113 }
114 };
115 }
116 };
117 if (!defined("CLIENT_DATA_DIR")) {
118 define("CLIENT_DATA_DIR", $ini->readVariable("clients", "datadir") . "/" . $client_id);
119 }
120 if (!defined("CLIENT_WEB_DIR")) {
121 define("CLIENT_WEB_DIR", dirname(__DIR__, 4) . "/data/" . $client_id);
122 }
123 if (!defined("ILIAS_ABSOLUTE_PATH")) {
124 define("ILIAS_ABSOLUTE_PATH", dirname(__FILE__, 5));
125 }
126 if (!defined("ILIAS_LOG_ENABLED")) {
127 define("ILIAS_LOG_ENABLED", false);
128 }
129 if (!defined("ROOT_FOLDER_ID")) {
130 define("ROOT_FOLDER_ID", (int) $client_ini->readVariable("system", "ROOT_FOLDER_ID"));
131 }
132 if (!defined("ROLE_FOLDER_ID")) {
133 define("ROLE_FOLDER_ID", (int) $client_ini->readVariable("system", "ROLE_FOLDER_ID"));
134 }
135 if (!defined("SYSTEM_FOLDER_ID")) {
136 define("SYSTEM_FOLDER_ID", (int) $client_ini->readVariable("system", "SYSTEM_FOLDER_ID"));
137 }
138
139 $db_update = new ilDBUpdate($db);
140
142 "custom_version",
143 $db_update->getCustomUpdatesCurrentVersion() ?? 0,
144 "The version of the custom database schema that is currently installed."
145 );
147 "available_custom_version",
148 $db_update->getCustomUpdatesFileVersion() ?? 0,
149 "The version of the custom database schema that is available in the current source."
150 );
152 "custom_update_required",
153 $db_update->customUpdatesAvailable(),
154 "Does the database require a custom update?"
155 );
156 } finally {
157 $GLOBALS["DIC"] = $DIC;
158 }
159 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
error(string $a_errmsg)
Database Update class.
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
storeStableBool(string $key, bool $value, ?string $description=null)
storeConfigText(string $key, string $value, ?string $description=null)
storeStableCounter(string $key, int $value, ?string $description=null)
$client_id
Definition: ltiauth.php:67
$ini
Definition: raiseError.php:20
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54

References $client_id, $DIC, $GLOBALS, $ini, ILIAS\Setup\Metrics\CollectedObjective\$storage, error(), ILIAS\Setup\Environment\getResource(), ILIAS\UI\examples\MessageBox\Info\info(), ILIAS\Setup\Metrics\Storage\storeConfigText(), ILIAS\Setup\Metrics\Storage\storeStableBool(), and ILIAS\Setup\Metrics\Storage\storeStableCounter().

+ Here is the call graph for this function:

◆ getTentativePreconditions()

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

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

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

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