MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / loadUnknownDbs

Function loadUnknownDbs

agent/app/service/device_clean.go:404–431  ·  view source on GitHub ↗
(fileOp fileUtils.FileOp, recordMap map[string][]string)

Source from the content-addressed store, hash-verified

402 return treeData
403}
404func loadUnknownDbs(fileOp fileUtils.FileOp, recordMap map[string][]string) dto.CleanTree {
405 dbs, _ := databaseRepo.GetList()
406 var excludePaths []string
407 dbMap := make(map[string]struct{})
408 for _, db := range dbs {
409 dbMap[fmt.Sprintf("database/%s/%s", db.Type, db.Name)] = struct{}{}
410 }
411 for key, val := range recordMap {
412 itemName := path.Dir(key)
413 if _, ok := dbMap[itemName]; ok {
414 for _, item := range val {
415 excludePaths = append(excludePaths, path.Join(global.Dir.LocalBackupDir, key, item))
416 }
417 }
418 }
419 backupPath := path.Join(global.Dir.LocalBackupDir, "database")
420 treeData := dto.CleanTree{
421 ID: uuid.NewString(),
422 Label: "unknown_database",
423 Name: backupPath,
424 IsCheck: false,
425 IsRecommend: false,
426 CanDelete: false,
427 Type: "unknown_backup",
428 }
429 _ = loadFileOrDirWithExclude(fileOp, 0, backupPath, &treeData, excludePaths)
430 return treeData
431}
432func loadUnknownWebsites(fileOp fileUtils.FileOp, recordMap map[string][]string) dto.CleanTree {
433 websites, _ := websiteRepo.List()
434 var excludePaths []string

Callers 1

loadBackupTreeFunction · 0.85

Calls 2

loadFileOrDirWithExcludeFunction · 0.85
GetListMethod · 0.65

Tested by

no test coverage detected