From 945ce7801042dfe201c108b447b64b22a1d8ed0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20TISSOT?= Date: Mon, 28 May 2018 16:16:45 +0200 Subject: [PATCH] https://github.com/pi-engine/guide/issues/1256 add innodb migration tool --- .../Controller/Admin/DatabaseController.php | 19 ++++++++++++++++++- .../template/admin/database-check.phtml | 18 ++++++++++++++++-- .../template/admin/database-index.phtml | 2 +- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/usr/module/system/src/Controller/Admin/DatabaseController.php b/usr/module/system/src/Controller/Admin/DatabaseController.php index 44ad215910..e303716503 100644 --- a/usr/module/system/src/Controller/Admin/DatabaseController.php +++ b/usr/module/system/src/Controller/Admin/DatabaseController.php @@ -32,6 +32,7 @@ public function checkAction() $tablesError = []; $columnsError = []; + $innodbError = []; foreach ($results->toArray() as $result) { $tableName = array_shift($result); @@ -44,10 +45,13 @@ public function checkAction() foreach ($res->toArray() as $params) { - if ($params['Collation'] && $params['Collation'] != 'utf8_general_ci') { $tablesError[$tableName] = $params['Collation']; } + + if ($params['Engine'] && $params['Engine'] != 'InnoDB') { + $innodbError[$tableName] = $params['Engine']; + } } $sql @@ -66,5 +70,18 @@ public function checkAction() $this->view()->assign('columnsError', $columnsError); $this->view()->assign('tablesError', $tablesError); + $this->view()->assign('innodbError', $innodbError); + } + + public function migrateAction() + { + $table = $this->params('table'); + + if($table){ + $sql = "ALTER TABLE $table ENGINE=InnoDB;"; + Pi::db()->getAdapter()->query($sql, 'execute'); + } + + $this->redirect()->toRoute('', ['action' => 'check']); } } \ No newline at end of file diff --git a/usr/module/system/template/admin/database-check.phtml b/usr/module/system/template/admin/database-check.phtml index e74d42e872..73086eab90 100755 --- a/usr/module/system/template/admin/database-check.phtml +++ b/usr/module/system/template/admin/database-check.phtml @@ -15,7 +15,7 @@
-
+
@@ -25,7 +25,7 @@
-
+
@@ -35,5 +35,19 @@
+
+
+
+ +
+
+
    + $tableType) : ?> +
  • () => InnoDB
  • + +
+
+
+
\ No newline at end of file diff --git a/usr/module/system/template/admin/database-index.phtml b/usr/module/system/template/admin/database-index.phtml index ddb612bc17..f29ee5488a 100755 --- a/usr/module/system/template/admin/database-index.phtml +++ b/usr/module/system/template/admin/database-index.phtml @@ -21,7 +21,7 @@