This commit is contained in:
tanghucheng
2023-08-17 16:42:21 +08:00
parent f527142e88
commit 120a31a1a4
2 changed files with 14 additions and 3 deletions
+1 -1
View File
@@ -486,7 +486,7 @@ class dbh
{
// 解析REPLACE INTO语句,提取出表名、字段和值
$matches = [];
preg_match('/^REPLACE\s+INTO\s+`?([\w_]+)`?\s*\((.*)\)\s+VALUES\s*\((.*?)\)\s*$/i', $sql, $matches);
preg_match('/^REPLACE\s+INTO\s+`?([\w_]+)`?\s*\((.*)\)\s+VALUES\s*\(([^()]+)\)\s*$/i', $sql, $matches);
$table_name = $matches[1];
$columns = array_map('trim', explode(',', $matches[2]));
$values = array_map('trim', explode(', ', $matches[3]));
+13 -2
View File
@@ -683,7 +683,13 @@ class upgradeModel extends model
break;
case '18_5':
$fromVersion = $this->loadModel('setting')->getItem('owner=system&module=common&section=global&key=version');
if(strpos($fromVersion, 'ipd') === false) $this->execSQL($this->getUpgradeFile('ipdinstall'));
$ipdinstall = false;
if(is_numeric($fromVersion[0]) and version_compare($fromVersion, '18.5', '<')) $ipdinstall = true;
if(strpos($fromVersion, 'biz') !== false and version_compare($fromVersion, 'biz8.5', '<')) $ipdinstall = true;
if(strpos($fromVersion, 'max') !== false and version_compare($fromVersion, 'max4.5', '<')) $ipdinstall = true;
if($ipdinstall) $this->execSQL($this->getUpgradeFile('ipdinstall'));
if($fromVersion == 'ipd1.0.beta1') $this->execSQL($this->getUpgradeFile('ipd1.0.beta1'));
if($this->config->edition == 'ipd' and strpos($fromVersion, 'ipd') === false) $this->addORPriv();
@@ -1180,7 +1186,12 @@ class upgradeModel extends model
case '18_4':
$confirmContent .= file_get_contents($this->getUpgradeFile('18.4'));
case '18_5':
if(strpos($fromVersion, 'ipd') === false) $confirmContent .= file_get_contents($this->getUpgradeFile('ipdinstall'));
$ipdinstall = false;
if(is_numeric($fromVersion[0]) and version_compare($fromVersion, '18.5', '<')) $ipdinstall = true;
if(strpos($fromVersion, 'biz') !== false and version_compare($fromVersion, 'biz8.5', '<')) $ipdinstall = true;
if(strpos($fromVersion, 'max') !== false and version_compare($fromVersion, 'max4.5', '<')) $ipdinstall = true;
if($ipdinstall) $confirmContent .= file_get_contents($this->getUpgradeFile('ipdinstall'));
$confirmContent .= file_get_contents($this->getUpgradeFile('18.5')); // confirm insert position.
}