ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilDatabaseEnvironmentValidObjective Class Reference
+ Inheritance diagram for ilDatabaseEnvironmentValidObjective:
+ Collaboration diagram for ilDatabaseEnvironmentValidObjective:

Public Member Functions

 getHash ()
 Get a hash for this objective. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 getPreconditions (Environment $environment)
 
 isApplicable (Environment $environment)
 
- Public Member Functions inherited from ILIAS\Setup\Objective
 achieve (Environment $environment)
 Objectives can be achieved. More...
 

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 115 of file class.ilDatabaseEnvironmentValidObjective.php.

References null.

Referenced by getPreconditions().

115  : void
116  {
117  if ($db === null) {
118  throw new UnachievableException(
119  "Database cannot be connected. Please check the credentials."
120  );
121  }
122  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Signals that some goal won't be achievable by actions of the system ever.
+ Here is the caller graph for this function:

◆ checkDefaultEngine()

ilDatabaseEnvironmentValidObjective::checkDefaultEngine ( ilDBInterface  $db)
protected

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

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

Referenced by getPreconditions().

77  {
78  $default_engine = 'unknown';
79  try {
80  $r = $db->query('SHOW ENGINES ');
81  while ($d = $db->fetchObject($r)) {
82  if (strtoupper((string) $d->Support) === 'DEFAULT') {
83  $default_engine = strtolower((string) $d->Engine);
84  break;
85  }
86  }
87  } catch (Throwable) {
88  }
89  $default_engine = strtolower($default_engine);
90 
91  if ($default_engine !== strtolower(self::INNO_DB)) {
92  throw new UnachievableException(
93  "The default database engine is not set to '" . self::INNO_DB
94  . ", `$default_engine` given'. Please set the default database engine to '"
95  . self::INNO_DB . " to proceed'."
96  );
97  }
98  }
Signals that some goal won't be achievable by actions of the system ever.
fetchObject(ilDBStatement $query_result)
query(string $query)
Run a (read-only) Query on the database.
$r
+ 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 100 of file class.ilDatabaseEnvironmentValidObjective.php.

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

Referenced by getPreconditions().

100  : void
101  {
102  $setting = $db->fetchObject($db->query('SELECT @@GLOBAL.innodb_default_row_format AS row_format;'));
103  $row_format = $setting->row_format ?? null;
104  if ($row_format === null || strtoupper((string) $row_format) !== self::ROW_FORMAT_DYNAMIC) {
105  throw new UnachievableException(
106  "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."
107  );
108  }
109  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Signals that some goal won't be achievable by actions of the system ever.
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 ( )

Get a hash for this objective.

The hash of two objectives must be the same, if they are the same objective, with the same config on the same environment, i.e. if the one is achieved the other is achieved as well because they are the same.

Implements ILIAS\Setup\Objective.

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

36  : string
37  {
38  return hash("sha256", self::class);
39  }

◆ getLabel()

ilDatabaseEnvironmentValidObjective::getLabel ( )

Get a label that describes this objective.

Implements ILIAS\Setup\Objective.

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

41  : string
42  {
43  return "The database server has valid settings.";
44  }

◆ getPreconditions()

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

Implements ILIAS\Setup\Objective.

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

References ILIAS\Setup\Objective\achieve(), checkDBAvailable(), checkDefaultEngine(), checkRowFormat(), and ILIAS\Setup\Environment\getResource().

54  : array
55  {
56  return [ ];
57  }
+ Here is the call graph for this function:

◆ isApplicable()

ilDatabaseEnvironmentValidObjective::isApplicable ( Environment  $environment)

Implements ILIAS\Setup\Objective.

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

127  : bool
128  {
129  return true;
130  }

◆ isNotable()

ilDatabaseEnvironmentValidObjective::isNotable ( )

Get to know if this is an interesting objective for a human.

Implements ILIAS\Setup\Objective.

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

46  : bool
47  {
48  return true;
49  }

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: