now it should work

This commit is contained in:
6543 2019-05-11 04:03:20 +02:00
parent 88cd69ed7b
commit d2c2b683e5

View File

@ -166,7 +166,7 @@ function file_add() {
#wenn einmal existiert ... #wenn einmal existiert ...
{ {
# undelet files ... # 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';")" local IDs_undel="$(db_query "SELECT ID FROM File WHERE 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';" 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 #same path wrong md5
@ -174,12 +174,15 @@ function file_add() {
db_query "UPDATE File SET TTSync=$TTSYNC_DEL,TTCheck='$DATE' 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 ... #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';")" local IDs_mv="$(db_query "SELECT ID FROM File WHERE 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';" 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';"

#es existiert genau so ein eintrag
local IDs_orig="$(db_query "SELECT ID FROM File WHERE MD5='$MD5' AND Name='$name' AND Folder='$folder';")"
} }


#wenn weder gelöschte wiederhergestellt noch verschobene dateien entdekt... -> neuer eintrag #wenn weder gelöschte wiederhergestellt noch verschobene dateien entdekt... -> neuer eintrag
[ "$((${#IDs_mv}+${#IDs_undel}))" -gt 0 ] && db_query "INSERT INTO File (Name,Folder,MD5,Size,TTSync,TTCheck) VALUES ('$name','$folder','$MD5','$SIZE',$TTSYNC_EXIST,'$DATE');" [ "$((${#IDs_mv}+${#IDs_undel}+${#IDs_orig}))" == 0 ] && db_query "INSERT INTO File (Name,Folder,MD5,Size,TTSync,TTCheck) VALUES ('$name','$folder','$MD5','$SIZE',$TTSYNC_EXIST,'$DATE');"


} }