Skip to content

Commit

Permalink
Update helper.php
Browse files Browse the repository at this point in the history
  • Loading branch information
funadmin authored Jan 20, 2022
1 parent 5ee89d4 commit 7f1943c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ function importsql($name){
* @return boolean
*/
if (!function_exists('uninstallsql')) {
function uninstallsql($name)
function uninstallsql($name)
{
$service = new Service(App::instance()); // 获取service 服务
$addons_path = $service->getAddonsPath(); // 插件列表
Expand All @@ -545,11 +545,14 @@ function uninstallsql($name)
$sql = str_replace('__PREFIX__', config('database.connections.mysql.prefix'),$sql);
$sql = explode("\r\n",$sql);
foreach ($sql as $k=>$v){
try {
Db::execute($v);
} catch (\PDOException $e) {
throw new PDOException($e->getMessage());
if(strpos(strtolower($v),'drop table')!==false){
try {
Db::execute($v);
} catch (\Exception $e) {
throw new Exception($e->getMessage());
}
}

}
}
return true;
Expand Down

0 comments on commit 7f1943c

Please sign in to comment.