From 1b19258bfc6a6c9ec15f12fdb0f7e957809cf30d Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Wed, 21 Jun 2023 10:31:15 +0800 Subject: [PATCH] * Revert code 12d6a65fcf. --- lib/dbh/dbh.class.php | 7 +++++++ module/install/model.php | 10 ---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/dbh/dbh.class.php b/lib/dbh/dbh.class.php index ae52ef7a42..bfe750ef22 100644 --- a/lib/dbh/dbh.class.php +++ b/lib/dbh/dbh.class.php @@ -459,6 +459,13 @@ class dbh $sql = preg_replace('/\,\s*(unique|fulltext)*\s+key[\_\"0-9a-z ]+\(+[\,\_\"0-9a-z ]+\)+/i', '', $sql); $sql = preg_replace('/ float\s*\(+[\,\_\"0-9a-z ]+\)+/i', ' float', $sql); + /* Convert "date" datetime to "date" datetime(0) to fix bug 25725, dm database datetime default 6 */ + preg_match_all('/"[0-9a-zA-Z]+" datetime/', $sql, $datetimeMatch); + if(!empty($datetimeMatch)) + { + foreach($datetimeMatch[0] as $match) $sql = str_replace($match, $match . '(0)', $sql); + } + if(strpos($sql, "ALTER TABLE") !== false) $sql = $this->convertAlterTableSql($sql); } diff --git a/module/install/model.php b/module/install/model.php index 9934dd29fb..07f055ffbd 100644 --- a/module/install/model.php +++ b/module/install/model.php @@ -423,16 +423,6 @@ class installModel extends model $table = str_replace('`ztv_', $this->config->db->name . '.`ztv_', $table); $table = str_replace('zt_', $this->config->db->prefix, $table); - if($this->config->db->driver != 'mysql') - { - /* Convert "date" datetime to "date" datetime(0) to fix bug 25725, dm database datetime default 6 */ - preg_match_all('/"[0-9a-zA-Z]+" datetime/', $table, $datetimeMatch); - if(!empty($datetimeMatch)) - { - foreach($datetimeMatch[0] as $match) $table = str_replace($match, $match . '(0)', $table); - } - } - $this->dbh->exec($table); } }