ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 
- Public Member Functions inherited from ilDatabaseObjective
 __construct (\ilDatabaseSetupConfig $config)
 

Additional Inherited Members

- Protected Attributes inherited from ilDatabaseObjective
 $config
 

Detailed Description

Member Function Documentation

◆ achieve()

ilDatabaseServerIsConnectableObjective::achieve ( Setup\Environment  $environment)

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

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

36  : Setup\Environment
37  {
38  $db = \ilDBWrapperFactory::getWrapper($this->config->getType());
39  $db->initFromIniFile($this->config->toMockIniFile());
40  try {
41  $connect = $db->connect();
42  } catch (PDOException $e) {
43  // 1049 is "unknown database", which is ok because we propably didn't
44  // install the db yet,.
45  if ($e->getCode() != 1049) {
46  throw $e;
47  } else {
48  $connect = true;
49  }
50  }
51  if (!$connect) {
52  throw new Setup\UnachievableException(
53  "Database cannot be reached. Please check the credentials."
54  );
55  }
56  return $environment;
57  }
+ Here is the call graph for this function:

◆ getHash()

ilDatabaseServerIsConnectableObjective::getHash ( )

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

9  : string
10  {
11  $pw = $this->config->getPassword();
12  return hash("sha256", implode("-", [
13  self::class,
14  $this->config->getHost(),
15  $this->config->getPort(),
16  $this->config->getUser(),
17  $pw ? $pw->toString() : ""
18  ]));
19  }

◆ getLabel()

ilDatabaseServerIsConnectableObjective::getLabel ( )

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

21  : string
22  {
23  return "The database server is connectable with the supplied configuration.";
24  }

◆ getPreconditions()

ilDatabaseServerIsConnectableObjective::getPreconditions ( Setup\Environment  $environment)

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

31  : array
32  {
33  return [];
34  }

◆ isApplicable()

ilDatabaseServerIsConnectableObjective::isApplicable ( Setup\Environment  $environment)

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

62  : bool
63  {
64  return true;
65  }

◆ isNotable()

ilDatabaseServerIsConnectableObjective::isNotable ( )

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

26  : bool
27  {
28  return true;
29  }

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