ILIAS  release_8 Revision v8.24
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)
 
 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

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

Member Function Documentation

◆ achieve()

ilDatabaseExistsObjective::achieve ( Setup\Environment  $environment)

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

59 : Setup\Environment
60 {
61 $db = \ilDBWrapperFactory::getWrapper($this->config->getType());
62 $db->initFromIniFile($this->config->toMockIniFile());
63 $connect = $db->connect(true);
64 if (!$connect) {
65 throw new Setup\UnachievableException(
66 "Database cannot be connected. Please check the credentials."
67 );
68 }
69
70 return $environment->withResource(Setup\Environment::RESOURCE_DATABASE, $db);
71 }
static getWrapper(string $a_type)

References ilDBWrapperFactory\getWrapper().

+ Here is the call graph for this function:

◆ getHash()

ilDatabaseExistsObjective::getHash ( )

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

25 : string
26 {
27 return hash("sha256", implode("-", [
28 self::class,
29 $this->config->getHost(),
30 $this->config->getPort(),
31 $this->config->getDatabase()
32 ]));
33 }

◆ getLabel()

ilDatabaseExistsObjective::getLabel ( )

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

35 : string
36 {
37 return "The database exists on the server.";
38 }

◆ getPreconditions()

ilDatabaseExistsObjective::getPreconditions ( Setup\Environment  $environment)
Returns
array<\ilDatabaseServerIsConnectableObjective|\ilDatabaseCreatedObjective>

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

48 : array
49 {
50 $preconditions = [
51 new \ilDatabaseServerIsConnectableObjective($this->config)
52 ];
53 if ($this->config->getCreateDatabase()) {
54 $preconditions[] = new \ilDatabaseCreatedObjective($this->config);
55 }
56 return $preconditions;
57 }

◆ isApplicable()

ilDatabaseExistsObjective::isApplicable ( Setup\Environment  $environment)

@inheritDoc

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

76 : bool
77 {
78 return true;
79 }

◆ isNotable()

ilDatabaseExistsObjective::isNotable ( )

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

40 : bool
41 {
42 return true;
43 }

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