ILIAS  release_8 Revision v8.24
ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration Class Reference
+ Inheritance diagram for ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration:
+ Collaboration diagram for ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration:

Public Member Functions

 getLabel ()
 @inheritDoc More...
 
 getDefaultAmountOfStepsPerRun ()
 @inheritDoc More...
 
 getPreconditions (Environment $environment)
 @inheritDoc More...
 
 step (Environment $environment)
 @inheritDoc More...
 
 getRemainingAmountOfSteps ()
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\Setup\Migration
 getLabel ()
 
 getDefaultAmountOfStepsPerRun ()
 Tell the default amount of steps to be executed for one run of the migration. More...
 
 getPreconditions (Environment $environment)
 Objectives the migration depend on. More...
 
 prepare (Environment $environment)
 Prepare the migration by means of some environment. More...
 
 step (Environment $environment)
 Run one step of the migration. More...
 
 getRemainingAmountOfSteps ()
 Count up how many "things" need to be migrated. More...
 

Protected Member Functions

 getNonInnoDBTables ()
 

Protected Attributes

string $db_name = null
 
ilDBInterface $database = null
 

Additional Inherited Members

- Data Fields inherited from ILIAS\Setup\Migration
const INFINITE = -1
 

Detailed Description

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

Member Function Documentation

◆ getDefaultAmountOfStepsPerRun()

ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration::getDefaultAmountOfStepsPerRun ( )

@inheritDoc

Implements ILIAS\Setup\Migration.

Definition at line 44 of file class.ilMysqlMyIsamToInnoDbMigration.php.

44 : int
45 {
46 return 20;
47 }

◆ getLabel()

ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration::getLabel ( )

@inheritDoc

Implements ILIAS\Setup\Migration.

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

36 : string
37 {
38 return "Migration to convert tables from MyISAM to Innodb service";
39 }

◆ getNonInnoDBTables()

ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration::getNonInnoDBTables ( )
protected

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

107 : array
108 {
109 $tables = [];
110 $set = $this->database->queryF("SELECT table_name
111 FROM INFORMATION_SCHEMA.TABLES
112 WHERE ENGINE != %s AND table_schema = %s;", ['text', 'text'], [
114 $this->db_name
115 ]);
116 while ($row = $this->database->fetchAssoc($set)) {
117 $tables[] = $row['table_name'];
118 }
119 return $tables;
120 }

References ilDBConstants\MYSQL_ENGINE_INNODB.

Referenced by ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration\getRemainingAmountOfSteps(), and ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration\step().

+ Here is the caller graph for this function:

◆ getPreconditions()

ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration::getPreconditions ( Environment  $environment)

◆ getRemainingAmountOfSteps()

ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration::getRemainingAmountOfSteps ( )

@inheritDoc

Implements ILIAS\Setup\Migration.

Definition at line 98 of file class.ilMysqlMyIsamToInnoDbMigration.php.

98 : int
99 {
100 if ($this->db_name !== null) {
101 $rows = $this->getNonInnoDBTables();
102 return count($rows);
103 }
104 return 0;
105 }
$rows
Definition: xhr_table.php:10

References $rows, and ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration\getNonInnoDBTables().

+ Here is the call graph for this function:

◆ step()

ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration::step ( Environment  $environment)

@inheritDoc

Exceptions
ilException

Implements ILIAS\Setup\Migration.

Definition at line 78 of file class.ilMysqlMyIsamToInnoDbMigration.php.

78 : void
79 {
80 $rows = $this->getNonInnoDBTables();
81 $table_name = array_pop($rows);
82
83 if (is_string($table_name) && $table_name !== '') {
84 try {
85 $this->database->migrateTableToEngine($table_name);
86 } catch (\ilDatabaseException $e) {
87 throw new UnachievableException(
88 "The migration of the following tables did throw errors, " .
89 "please resolve the problem before you continue: \n" . $table_name . " -> " . $e->getMessage()
90 );
91 }
92 }
93 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References Vendor\Package\$e, $rows, and ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration\getNonInnoDBTables().

+ Here is the call graph for this function:

Field Documentation

◆ $database

ilDBInterface ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration::$database = null
protected

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

◆ $db_name

string ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration::$db_name = null
protected

Definition at line 30 of file class.ilMysqlMyIsamToInnoDbMigration.php.


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