Skip to content

Commit 7f1943c

Browse files
authored
Update helper.php
1 parent 5ee89d4 commit 7f1943c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/helper.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ function importsql($name){
535535
* @return boolean
536536
*/
537537
if (!function_exists('uninstallsql')) {
538-
function uninstallsql($name)
538+
function uninstallsql($name)
539539
{
540540
$service = new Service(App::instance()); // 获取service 服务
541541
$addons_path = $service->getAddonsPath(); // 插件列表
@@ -545,11 +545,14 @@ function uninstallsql($name)
545545
$sql = str_replace('__PREFIX__', config('database.connections.mysql.prefix'),$sql);
546546
$sql = explode("\r\n",$sql);
547547
foreach ($sql as $k=>$v){
548-
try {
549-
Db::execute($v);
550-
} catch (\PDOException $e) {
551-
throw new PDOException($e->getMessage());
548+
if(strpos(strtolower($v),'drop table')!==false){
549+
try {
550+
Db::execute($v);
551+
} catch (\Exception $e) {
552+
throw new Exception($e->getMessage());
553+
}
552554
}
555+
553556
}
554557
}
555558
return true;

0 commit comments

Comments
 (0)