diff --git a/tools/db/update-file-state b/tools/db/update-file-state index df07403..2b482cb 100644 --- a/tools/db/update-file-state +++ b/tools/db/update-file-state @@ -168,14 +168,19 @@ function file_add() { #wenn einmal existiert ... if [ "${#IDs[@]}" -gt 0 ]; then # undelet files ... + local IDs_undel="$(db_query "SELECT ID FROM File WHERE AND TTSync='$TTSYNC_DEL' AND MD5='$MD5' AND Name='$name' AND Folder='$folder';")" db_query "UPDATE File SET TTSync=$TTSYNC_EXIST,TTCheck='$DATE',Size='$SIZE' WHERE AND TTSync='$TTSYNC_DEL' AND MD5='$MD5' AND Name='$name' AND Folder='$folder';" #same path wrong md5 + #local IDs_W5="$(db_query "SELECT ID FROM File WHERE TTSync!='$TTSYNC_REMOTE' AND MD5!='$MD5' AND Name='$name' AND Folder='$folder';")" db_query "UPDATE File SET TTSync=$TTSYNC_DEL,TTCheck='$DATE' WHERE TTSync!='$TTSYNC_REMOTE' AND MD5!='$MD5' AND Name='$name' AND Folder='$folder';" #if something MVs ... + local IDs_mv="$(db_query "SELECT ID FROM File WHERE AND MD5='$MD5' AND Size='$SIZE' AND Name!='$name' AND Folder!='$folder';")" db_query "UPDATE File SET TTCheck='$DATE',Name='$name',Folder='$folder',TTSync='$TTSYNC_EXIST' WHERE AND MD5='$MD5' AND Size='$SIZE' AND Name!='$name' AND Folder!='$folder';" + #wenn gelöschte wiederhergestellt oder verschobene dateien entdekt... -> func done + else db_query "INSERT INTO File (Name,Folder,MD5,Size,TTSync,TTCheck) VALUES ('$name','$folder','$MD5','$SIZE',$TTSYNC_EXIST,'$DATE');" fi