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

Function changeLocalBackup

agent/app/service/backup.go:595–640  ·  view source on GitHub ↗
(oldPath, newPath string)

Source from the content-addressed store, hash-verified

593}
594
595func changeLocalBackup(oldPath, newPath string) error {
596 fileOp := files.NewFileOp()
597 if fileOp.Stat(path.Join(oldPath, "app")) {
598 if err := fileOp.CopyDir(path.Join(oldPath, "app"), newPath); err != nil {
599 return err
600 }
601 }
602 if fileOp.Stat(path.Join(oldPath, "database")) {
603 if err := fileOp.CopyDir(path.Join(oldPath, "database"), newPath); err != nil {
604 return err
605 }
606 }
607 if fileOp.Stat(path.Join(oldPath, "directory")) {
608 if err := fileOp.CopyDir(path.Join(oldPath, "directory"), newPath); err != nil {
609 return err
610 }
611 }
612 if fileOp.Stat(path.Join(oldPath, "system_snapshot")) {
613 if err := fileOp.CopyDir(path.Join(oldPath, "system_snapshot"), newPath); err != nil {
614 return err
615 }
616 }
617 if fileOp.Stat(path.Join(oldPath, "website")) {
618 if err := fileOp.CopyDir(path.Join(oldPath, "website"), newPath); err != nil {
619 return err
620 }
621 }
622 if fileOp.Stat(path.Join(oldPath, "log")) {
623 if err := fileOp.CopyDir(path.Join(oldPath, "log"), newPath); err != nil {
624 return err
625 }
626 }
627 if fileOp.Stat(path.Join(oldPath, "master")) {
628 if err := fileOp.CopyDir(path.Join(oldPath, "master"), newPath); err != nil {
629 return err
630 }
631 }
632 _ = fileOp.RmRf(path.Join(oldPath, "app"))
633 _ = fileOp.RmRf(path.Join(oldPath, "database"))
634 _ = fileOp.RmRf(path.Join(oldPath, "directory"))
635 _ = fileOp.RmRf(path.Join(oldPath, "system_snapshot"))
636 _ = fileOp.RmRf(path.Join(oldPath, "website"))
637 _ = fileOp.RmRf(path.Join(oldPath, "log"))
638 _ = fileOp.RmRf(path.Join(oldPath, "master"))
639 return nil
640}

Callers 1

UpdateMethod · 0.85

Calls 3

StatMethod · 0.95
CopyDirMethod · 0.95
RmRfMethod · 0.95

Tested by

no test coverage detected