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

Public Member Functions

 getHash ()
 
 getLabel ()
 
 isNotable ()
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 
- Public Member Functions inherited from ilDatabaseObjective
 __construct (\ilDatabaseSetupConfig $config)
 

Additional Inherited Members

- Protected Attributes inherited from ilDatabaseObjective
ilDatabaseSetupConfig $config
 

Detailed Description

Definition at line 23 of file class.ilDatabaseConfigStoredObjective.php.

Member Function Documentation

◆ achieve()

ilDatabaseConfigStoredObjective::achieve ( Setup\Environment  $environment)

Definition at line 51 of file class.ilDatabaseConfigStoredObjective.php.

References $type, and ILIAS\Setup\Environment\getResource().

51  : Setup\Environment
52  {
53  $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
54 
55  $type = $this->config->getType();
56 
57  if ($type === 'postgres' || $type === 'pdo-postgre') {
58  throw new Setup\NotExecutableException('ILIAS 8 no longer Supports POSTGRES');
59  }
60 
61  $client_ini->setVariable("db", "type", $type);
62  $client_ini->setVariable("db", "host", $this->config->getHost());
63  $client_ini->setVariable("db", "name", $this->config->getDatabase());
64  $client_ini->setVariable("db", "user", $this->config->getUser());
65  $client_ini->setVariable("db", "port", (string) ($this->config->getPort() ?? ""));
66  $pw = $this->config->getPassword();
67  $client_ini->setVariable("db", "pass", $pw !== null ? $pw->toString() : "");
68 
69  if (!$client_ini->write()) {
70  throw new Setup\UnachievableException("Could not write client.ini.php");
71  }
72 
73  return $environment;
74  }
$type
+ Here is the call graph for this function:

◆ getHash()

ilDatabaseConfigStoredObjective::getHash ( )

Definition at line 25 of file class.ilDatabaseConfigStoredObjective.php.

25  : string
26  {
27  return hash("sha256", self::class);
28  }

◆ getLabel()

ilDatabaseConfigStoredObjective::getLabel ( )

Definition at line 30 of file class.ilDatabaseConfigStoredObjective.php.

30  : string
31  {
32  return "Fill ini with settings for Services/Database";
33  }

◆ getPreconditions()

ilDatabaseConfigStoredObjective::getPreconditions ( Setup\Environment  $environment)
Returns
array<int, |>

Definition at line 43 of file class.ilDatabaseConfigStoredObjective.php.

43  : array
44  {
45  return [
47  new ilDatabaseExistsObjective($this->config)
48  ];
49  }

◆ isApplicable()

ilDatabaseConfigStoredObjective::isApplicable ( Setup\Environment  $environment)

Definition at line 76 of file class.ilDatabaseConfigStoredObjective.php.

76  : bool
77  {
78  $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
79 
80  $port = $this->config->getPort() ?? "";
81  $pass = $this->config->getPassword() !== null ? $this->config->getPassword()->toString() : "";
82 
83  return
84  $client_ini->readVariable("db", "type") !== $this->config->getType() ||
85  $client_ini->readVariable("db", "host") !== $this->config->getHost() ||
86  $client_ini->readVariable("db", "name") !== $this->config->getDatabase() ||
87  $client_ini->readVariable("db", "user") !== $this->config->getUser() ||
88  $client_ini->readVariable("db", "port") !== $port ||
89  $client_ini->readVariable("dv", "pass") !== $pass
90  ;
91  }

◆ isNotable()

ilDatabaseConfigStoredObjective::isNotable ( )

Definition at line 35 of file class.ilDatabaseConfigStoredObjective.php.

35  : bool
36  {
37  return false;
38  }

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