|
|
|
@ -619,6 +619,7 @@ func DeleteIfSafeGMA(pw progress.Writer, filePath string) (err error) {
|
|
|
|
|
if dboGMA_sameHash.OriginalPath != filePath {
|
|
|
|
|
pw.Log("originalpath differs for this hash")
|
|
|
|
|
// DB_GMA_Alias
|
|
|
|
|
dboGMA.OriginalPath = dboGMA_sameHash.OriginalPath
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if dboGMA.OriginalPath == filePath {
|
|
|
|
@ -657,21 +658,20 @@ func DeleteIfSafeGMA(pw progress.Writer, filePath string) (err error) {
|
|
|
|
|
return fmt.Errorf("650-: %v", err)
|
|
|
|
|
}
|
|
|
|
|
if originalDeletionData.Deleted {
|
|
|
|
|
pw.Log(filepath.Base(filePath))
|
|
|
|
|
pw.Log(filepath.Base(dboGMA_sameHash.OriginalPath))
|
|
|
|
|
pw.Log("")
|
|
|
|
|
aliasData := common.DB_GMA_Alias{
|
|
|
|
|
Path: filePath,
|
|
|
|
|
Hash: dboGMA.GMAHash,
|
|
|
|
|
Deleted: true,
|
|
|
|
|
Path: filePath,
|
|
|
|
|
Hash: dboGMA.GMAHash,
|
|
|
|
|
Deleted: true,
|
|
|
|
|
MigrationID: common.CreateMigrationID(filePath),
|
|
|
|
|
}
|
|
|
|
|
recoveryPath := filepath.Join("/zpool0/cheetah/workshop/garrysmod/gma-inator/recovery-tree", fmt.Sprintf("%s.json", dboGMA.OriginalPath))
|
|
|
|
|
if checkFileExists(recoveryPath) {
|
|
|
|
|
err = os.Remove(aliasData.Path)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
pw.Log("deleted %s duplicate, original was %s", aliasData.Path, dboGMA.OriginalPath)
|
|
|
|
|
} else {
|
|
|
|
|
pw.Log("%s recoveryPath does not exist %s", filePath, recoveryPath)
|
|
|
|
|
err = os.Remove(aliasData.Path)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
pw.Log("deleted %s", aliasData.Path)
|
|
|
|
|
lzmaFile := fmt.Sprintf("%s.lzma", aliasData.Path)
|
|
|
|
|
if checkFileExists(lzmaFile) {
|
|
|
|
|
err = os.Remove(lzmaFile)
|
|
|
|
@ -680,7 +680,10 @@ func DeleteIfSafeGMA(pw progress.Writer, filePath string) (err error) {
|
|
|
|
|
}
|
|
|
|
|
pw.Log("deleted %s", lzmaFile)
|
|
|
|
|
}
|
|
|
|
|
_, _ = colAliases.CreateDocument(arangoCTX, aliasData)
|
|
|
|
|
_, err = colAliases.CreateDocument(arangoCTX, aliasData)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return fmt.Errorf("originals have not been deleted")
|
|
|
|
|
}
|
|
|
|
@ -1208,6 +1211,7 @@ func ProcessGMA(pw progress.Writer, filePath string) (err error) {
|
|
|
|
|
dboGMA.ProcessingEnd = time.Now()
|
|
|
|
|
dboGMA.ProcessingDuration = dboGMA.ProcessingEnd.Sub(dboGMA.ProcessingStart).Milliseconds()
|
|
|
|
|
dboGMA.Success = true
|
|
|
|
|
dboGMA.MigrationID = common.CreateMigrationID(dboGMA.OriginalPath)
|
|
|
|
|
|
|
|
|
|
_, err = colGMA.UpdateDocument(arangoCTX, dboGMA.ID, dboGMA)
|
|
|
|
|
if err != nil {
|
|
|
|
|