mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
API: Improve file operation logs
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -2,6 +2,7 @@ package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/dustin/go-humanize/english"
|
||||
@@ -382,6 +383,10 @@ func BatchPhotosDelete(router *gin.RouterGroup) {
|
||||
|
||||
// Delete photos.
|
||||
for _, p := range photos {
|
||||
// Report file deletion.
|
||||
event.AuditWarn([]string{ClientIP(c), s.UserName, "delete", path.Join(p.PhotoPath, p.PhotoName+"*")})
|
||||
|
||||
// Remove all related files from storage.
|
||||
n, err := photoprism.DeletePhoto(p, true, true)
|
||||
|
||||
numFiles += n
|
||||
|
||||
@@ -68,6 +68,9 @@ func DeleteFile(router *gin.RouterGroup) {
|
||||
return
|
||||
}
|
||||
|
||||
// Report file deletion.
|
||||
event.AuditWarn([]string{ClientIP(c), s.UserName, "delete", file.FileName})
|
||||
|
||||
// Remove file from storage.
|
||||
if err = mediaFile.Remove(); err != nil {
|
||||
log.Errorf("files: %s (delete %s from folder)", err, clean.Log(baseName))
|
||||
|
||||
Reference in New Issue
Block a user