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

Public Member Functions

 getHash ()
 
 getLabel ()
 
 isNotable ()
 
 getPreconditions (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 

Protected Member Functions

 checkDefaultEngine (ilDBInterface $db)
 
 checkRowFormat (ilDBInterface $db)
 
 checkDBAvailable (?ilDBInterface $db)
 

Private Attributes

const ROW_FORMAT_DYNAMIC = "DYNAMIC"
 
const INNO_DB = "InnoDB"
 

Detailed Description

Member Function Documentation

◆ checkDBAvailable()

ilDatabaseEnvironmentValidObjective::checkDBAvailable ( ?ilDBInterface  $db)
protected
Parameters
ilDBInterface$db
Returns
void

Definition at line 107 of file class.ilDatabaseEnvironmentValidObjective.php.

Referenced by getPreconditions().

107  : void
108  {
109  if ($db === null) {
110  throw new Setup\UnachievableException(
111  "Database cannot be connected. Please check the credentials."
112  );
113  }
114  }
+ Here is the caller graph for this function:

◆ checkDefaultEngine()

ilDatabaseEnvironmentValidObjective::checkDefaultEngine ( ilDBInterface  $db)
protected

Definition at line 68 of file class.ilDatabaseEnvironmentValidObjective.php.

References $d, Vendor\Package\$e, ilDBInterface\fetchObject(), and ilDBInterface\query().

Referenced by getPreconditions().

69  {
70  $default_engine = 'unknown';
71  try {
72  $r = $db->query('SHOW ENGINES ');
73  while ($d = $db->fetchObject($r)) {
74  if (strtoupper($d->Support) === 'DEFAULT') {
75  $default_engine = strtolower($d->Engine);
76  break;
77  }
78  }
79  } catch (Throwable $e) {
80  }
81  $default_engine = strtolower($default_engine);
82 
83  if ($default_engine !== strtolower(self::INNO_DB)) {
84  throw new Setup\UnachievableException(
85  "The default database engine is not set to '" . self::INNO_DB
86  . ", `$default_engine` given'. Please set the default database engine to '"
87  . self::INNO_DB . " to proceed'."
88  );
89  }
90  }
fetchObject(ilDBStatement $query_result)
query(string $query)
Run a (read-only) Query on the database.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkRowFormat()

ilDatabaseEnvironmentValidObjective::checkRowFormat ( ilDBInterface  $db)
protected

Definition at line 92 of file class.ilDatabaseEnvironmentValidObjective.php.

References ilDBInterface\fetchObject(), and ilDBInterface\query().

Referenced by getPreconditions().

92  : void
93  {
94  $setting = $db->fetchObject($db->query('SELECT @@GLOBAL.innodb_default_row_format AS row_format;'));
95  $row_format = $setting->row_format ?? null;
96  if ($row_format === null || strtoupper($row_format) !== self::ROW_FORMAT_DYNAMIC) {
97  throw new Setup\UnachievableException(
98  "The default row format of the database is not set to '" . self::ROW_FORMAT_DYNAMIC . "'. Please set the default row format to " . self::ROW_FORMAT_DYNAMIC . " and run an 'OPTIMIZE TABLE' for each of your database tables before you continue."
99  );
100  }
101  }
fetchObject(ilDBStatement $query_result)
query(string $query)
Run a (read-only) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHash()

ilDatabaseEnvironmentValidObjective::getHash ( )

Definition at line 28 of file class.ilDatabaseEnvironmentValidObjective.php.

28  : string
29  {
30  return hash("sha256", self::class);
31  }

◆ getLabel()

ilDatabaseEnvironmentValidObjective::getLabel ( )

Definition at line 33 of file class.ilDatabaseEnvironmentValidObjective.php.

33  : string
34  {
35  return "The database server has valid settings.";
36  }

◆ getPreconditions()

ilDatabaseEnvironmentValidObjective::getPreconditions ( Setup\Environment  $environment)
Returns
array<|>

Definition at line 46 of file class.ilDatabaseEnvironmentValidObjective.php.

References checkDBAvailable(), checkDefaultEngine(), and checkRowFormat().

46  : array
47  {
48  return [ ];
49  }
+ Here is the call graph for this function:

◆ isApplicable()

ilDatabaseEnvironmentValidObjective::isApplicable ( Setup\Environment  $environment)

Definition at line 119 of file class.ilDatabaseEnvironmentValidObjective.php.

119  : bool
120  {
121  return true;
122  }

◆ isNotable()

ilDatabaseEnvironmentValidObjective::isNotable ( )

Definition at line 38 of file class.ilDatabaseEnvironmentValidObjective.php.

38  : bool
39  {
40  return true;
41  }

Field Documentation

◆ INNO_DB

const ilDatabaseEnvironmentValidObjective::INNO_DB = "InnoDB"
private

◆ ROW_FORMAT_DYNAMIC

const ilDatabaseEnvironmentValidObjective::ROW_FORMAT_DYNAMIC = "DYNAMIC"
private

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