mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 22:18:07 +08:00
fix: 解决删除应用时 数据库状态错误导致脏数据的BUG
This commit is contained in:
parent
bb9c2490c4
commit
b7ddb6fd42
@ -403,17 +403,6 @@ func (a AppInstallService) DeleteCheck(installId uint) ([]dto.AppResource, error
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if app.Key == constant.AppMysql {
|
|
||||||
databases, _ := mysqlRepo.List()
|
|
||||||
for _, database := range databases {
|
|
||||||
res = append(res, dto.AppResource{
|
|
||||||
Type: "database",
|
|
||||||
Name: database.Name,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,10 +137,10 @@ func deleteAppInstall(ctx context.Context, install model.AppInstall, deleteBacku
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := appInstallRepo.Delete(ctx, install); err != nil && !forceDelete {
|
if err := appInstallRepo.Delete(ctx, install); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := deleteLink(ctx, &install, deleteDB); err != nil && !forceDelete {
|
if err := deleteLink(ctx, &install, deleteDB, forceDelete); err != nil && !forceDelete {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
uploadDir := fmt.Sprintf("%s/1panel/uploads/app/%s/%s", global.CONF.System.BaseDir, install.App.Key, install.Name)
|
uploadDir := fmt.Sprintf("%s/1panel/uploads/app/%s/%s", global.CONF.System.BaseDir, install.App.Key, install.Name)
|
||||||
@ -163,7 +163,7 @@ func deleteAppInstall(ctx context.Context, install model.AppInstall, deleteBacku
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteLink(ctx context.Context, install *model.AppInstall, deleteDB bool) error {
|
func deleteLink(ctx context.Context, install *model.AppInstall, deleteDB bool, forceDelete bool) error {
|
||||||
resources, _ := appInstallResourceRepo.GetBy(appInstallResourceRepo.WithAppInstallId(install.ID))
|
resources, _ := appInstallResourceRepo.GetBy(appInstallResourceRepo.WithAppInstallId(install.ID))
|
||||||
if len(resources) == 0 {
|
if len(resources) == 0 {
|
||||||
return nil
|
return nil
|
||||||
@ -177,7 +177,8 @@ func deleteLink(ctx context.Context, install *model.AppInstall, deleteDB bool) e
|
|||||||
}
|
}
|
||||||
if err := mysqlService.Delete(ctx, dto.MysqlDBDelete{
|
if err := mysqlService.Delete(ctx, dto.MysqlDBDelete{
|
||||||
ID: database.ID,
|
ID: database.ID,
|
||||||
}); err != nil {
|
ForceDelete: forceDelete,
|
||||||
|
}); err != nil && !forceDelete {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@ func (f FileService) SearchUploadWithPage(req request.SearchUploadWithPage) (int
|
|||||||
files []response.UploadInfo
|
files []response.UploadInfo
|
||||||
backData []response.UploadInfo
|
backData []response.UploadInfo
|
||||||
)
|
)
|
||||||
|
|
||||||
_ = filepath.Walk(req.Path, func(path string, info os.FileInfo, err error) error {
|
_ = filepath.Walk(req.Path, func(path string, info os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user