ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDatabaseExistsObjective Class Reference
+ Inheritance diagram for ilDatabaseExistsObjective:
+ Collaboration diagram for ilDatabaseExistsObjective:

Public Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from ilDatabaseObjective
 $config
 

Detailed Description

Definition at line 7 of file class.ilDatabaseExistsObjective.php.

Member Function Documentation

◆ achieve()

ilDatabaseExistsObjective::achieve ( Setup\Environment  $environment)

Definition at line 40 of file class.ilDatabaseExistsObjective.php.

References ilDBWrapperFactory\getWrapper().

40  : Setup\Environment
41  {
42  $db = \ilDBWrapperFactory::getWrapper($this->config->getType());
43  $db->initFromIniFile($this->config->toMockIniFile());
44  $connect = $db->connect(true);
45  if (!$connect) {
46  throw new Setup\UnachievableException(
47  "Database cannot be connected. Please check the credentials."
48  );
49  }
50  return $environment->withResource(Setup\Environment::RESOURCE_DATABASE, $db);
51  }
+ Here is the call graph for this function:

◆ getHash()

ilDatabaseExistsObjective::getHash ( )

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

9  : string
10  {
11  return hash("sha256", implode("-", [
12  self::class,
13  $this->config->getHost(),
14  $this->config->getPort(),
15  $this->config->getDatabase()
16  ]));
17  }

◆ getLabel()

ilDatabaseExistsObjective::getLabel ( )

Definition at line 19 of file class.ilDatabaseExistsObjective.php.

19  : string
20  {
21  return "The database exists on the server.";
22  }

◆ getPreconditions()

ilDatabaseExistsObjective::getPreconditions ( Setup\Environment  $environment)

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

29  : array
30  {
31  $preconditions = [
32  new \ilDatabaseServerIsConnectableObjective($this->config)
33  ];
34  if ($this->config->getCreateDatabase()) {
35  $preconditions[] = new \ilDatabaseCreatedObjective($this->config);
36  }
37  return $preconditions;
38  }

◆ isNotable()

ilDatabaseExistsObjective::isNotable ( )

Definition at line 24 of file class.ilDatabaseExistsObjective.php.

24  : bool
25  {
26  return true;
27  }

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