ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 27 of file class.ilMysqlMyIsamToInnoDbMigration.php.

Member Function Documentation

◆ getDefaultAmountOfStepsPerRun()

ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration::getDefaultAmountOfStepsPerRun ( )

@inheritDoc

Implements ILIAS\Setup\Migration.

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

43 : int
44 {
45 return 20;
46 }

◆ getLabel()

ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration::getLabel ( )

@inheritDoc

Implements ILIAS\Setup\Migration.

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

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

◆ getNonInnoDBTables()

ILIAS\Setup\ilMysqlMyIsamToInnoDbMigration::getNonInnoDBTables ( )
protected

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

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

References ILIAS\Repository\database(), and ilDBConstants\MYSQL_ENGINE_INNODB.

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

+ Here is the call graph for this function:
+ 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 97 of file class.ilMysqlMyIsamToInnoDbMigration.php.

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

References 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 77 of file class.ilMysqlMyIsamToInnoDbMigration.php.

77 : void
78 {
79 $rows = $this->getNonInnoDBTables();
80 $table_name = array_pop($rows);
81
82 if (is_string($table_name) && $table_name !== '') {
83 try {
84 $this->database->migrateTableToEngine($table_name);
85 } catch (\ilDatabaseException $e) {
86 throw new UnachievableException(
87 "The migration of the following tables did throw errors, " .
88 "please resolve the problem before you continue: \n" . $table_name . " -> " . $e->getMessage()
89 );
90 }
91 }
92 }
Class ilDatabaseException.

References Vendor\Package\$e, ILIAS\Repository\database(), 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 30 of file class.ilMysqlMyIsamToInnoDbMigration.php.

◆ $db_name

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

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


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