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