ILIAS  release_8 Revision v8.24
ilDatabaseServerIsConnectableObjective Class Reference
+ Inheritance diagram for ilDatabaseServerIsConnectableObjective:
+ Collaboration diagram for ilDatabaseServerIsConnectableObjective:

Public Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from ilDatabaseObjective
ilDatabaseSetupConfig $config
 

Detailed Description

Member Function Documentation

◆ achieve()

ilDatabaseServerIsConnectableObjective::achieve ( Setup\Environment  $environment)

Definition at line 52 of file class.ilDatabaseServerIsConnectableObjective.php.

52 : Setup\Environment
53 {
54 $db = \ilDBWrapperFactory::getWrapper($this->config->getType());
55 $db->initFromIniFile($this->config->toMockIniFile());
56 try {
57 $connect = $db->connect();
58 } catch (PDOException $e) {
59 // 1049 is "unknown database", which is ok because we propably didn't
60 // install the db yet,.
61 if ($e->getCode() !== 1049) {
62 throw $e;
63 }
64
65 $connect = true;
66 }
67 if (!$connect) {
68 throw new Setup\UnachievableException(
69 "Database cannot be reached. Please check the credentials."
70 );
71 }
72
73 return $environment;
74 }
static getWrapper(string $a_type)

References Vendor\Package\$e, and ilDBWrapperFactory\getWrapper().

+ Here is the call graph for this function:

◆ getHash()

ilDatabaseServerIsConnectableObjective::getHash ( )

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

25 : string
26 {
27 $pw = $this->config->getPassword();
28 return hash("sha256", implode("-", [
29 self::class,
30 $this->config->getHost(),
31 $this->config->getPort(),
32 $this->config->getUser(),
33 $pw !== null ? $pw->toString() : ""
34 ]));
35 }

◆ getLabel()

ilDatabaseServerIsConnectableObjective::getLabel ( )

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

37 : string
38 {
39 return "The database server is connectable with the supplied configuration.";
40 }

◆ getPreconditions()

ilDatabaseServerIsConnectableObjective::getPreconditions ( Setup\Environment  $environment)

Definition at line 47 of file class.ilDatabaseServerIsConnectableObjective.php.

47 : array
48 {
49 return [];
50 }

◆ isApplicable()

ilDatabaseServerIsConnectableObjective::isApplicable ( Setup\Environment  $environment)

@inheritDoc

Definition at line 79 of file class.ilDatabaseServerIsConnectableObjective.php.

79 : bool
80 {
81 return true;
82 }

◆ isNotable()

ilDatabaseServerIsConnectableObjective::isNotable ( )

Definition at line 42 of file class.ilDatabaseServerIsConnectableObjective.php.

42 : bool
43 {
44 return true;
45 }

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