From 9959006f46892a9794a7e82130a37403e28e3feb Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 10 Aug 2022 09:43:20 +0800 Subject: [PATCH] * change upgrade for change engine. --- module/project/view/create.html.php | 2 +- module/upgrade/control.php | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/module/project/view/create.html.php b/module/project/view/create.html.php index 0405629ef2..f28baf0d6a 100755 --- a/module/project/view/create.html.php +++ b/module/project/view/create.html.php @@ -39,7 +39,7 @@ - + diff --git a/module/upgrade/control.php b/module/upgrade/control.php index db3875f0f5..d2fb523a88 100644 --- a/module/upgrade/control.php +++ b/module/upgrade/control.php @@ -919,8 +919,7 @@ class upgrade extends control $response['message'] = ''; $response['nextMessage'] = ''; - $stmt = $this->dao->query("SHOW TABLE STATUS WHERE `Engine` is not null AND `Engine` = 'MyISAM'"); - + $stmt = $this->dao->query("SHOW TABLE STATUS WHERE `Engine` is not null AND `Engine` = 'MyISAM'"); $table = $stmt->fetch(); if(empty($table)) { @@ -939,14 +938,28 @@ class upgrade extends control $tableName = $table->Name; $response['table'] = $tableName; + + /* Check process this table or not. */ + $dbProcesses = $this->dao->query("SHOW PROCESSLIST")->fetchAll(); + foreach($dbProcesses as $dbProcess) + { + if($dbProcess->db != $this->config->db->name) continue; + if(strpos($dbProcess->Info, " `{$tableName}` ")) + { + $response['message'] = sprintf($this->lang->upgrade->changingTable, $response['table']); + return print(json_encode($response)); + } + } + if($nextTable) { - $response['next'] = $nextTable->Name; + $response['next'] = $nextTable->Name; if($response['next']) $response['nextMessage'] = sprintf($this->lang->upgrade->changingTable, $response['next']); } if(stripos($tableName, 'searchindex') !== false) { + /* Change fulltext index. */ $stmt = $this->dao->query("show index from `$tableName`"); $indexes = array(); while($index = $stmt->fetch())