mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-02 13:14:39 +00:00
Check message/attachment files on manual clean only
This commit is contained in:
parent
965dfdb84b
commit
1774a619e0
1 changed files with 21 additions and 19 deletions
|
@ -135,27 +135,29 @@ public class WorkerCleanup extends Worker {
|
||||||
Log.w("Error deleting " + file);
|
Log.w("Error deleting " + file);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check message files
|
if (manual) {
|
||||||
Log.i("Checking message files");
|
// Check message files
|
||||||
List<Long> mids = db.message().getMessageWithContent();
|
Log.i("Checking message files");
|
||||||
for (Long mid : mids) {
|
List<Long> mids = db.message().getMessageWithContent();
|
||||||
EntityMessage message = db.message().getMessage(mid);
|
for (Long mid : mids) {
|
||||||
File file = message.getFile(context);
|
EntityMessage message = db.message().getMessage(mid);
|
||||||
if (!file.exists()) {
|
File file = message.getFile(context);
|
||||||
Log.w("Message file missing id=" + mid);
|
if (!file.exists()) {
|
||||||
db.message().setMessageContent(mid, false);
|
Log.w("Message file missing id=" + mid);
|
||||||
|
db.message().setMessageContent(mid, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Check attachments files
|
// Check attachments files
|
||||||
Log.i("Checking attachments files");
|
Log.i("Checking attachments files");
|
||||||
List<Long> aids = db.attachment().getAttachmentAvailable();
|
List<Long> aids = db.attachment().getAttachmentAvailable();
|
||||||
for (Long aid : aids) {
|
for (Long aid : aids) {
|
||||||
EntityAttachment attachment = db.attachment().getAttachment(aid);
|
EntityAttachment attachment = db.attachment().getAttachment(aid);
|
||||||
File file = attachment.getFile(context);
|
File file = attachment.getFile(context);
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
Log.w("Attachment file missing id=" + aid);
|
Log.w("Attachment file missing id=" + aid);
|
||||||
db.attachment().setUnavailable(aid);
|
db.attachment().setUnavailable(aid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue