mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-30 19:56:10 +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);
|
||||
}
|
||||
|
||||
// Check message files
|
||||
Log.i("Checking message files");
|
||||
List<Long> mids = db.message().getMessageWithContent();
|
||||
for (Long mid : mids) {
|
||||
EntityMessage message = db.message().getMessage(mid);
|
||||
File file = message.getFile(context);
|
||||
if (!file.exists()) {
|
||||
Log.w("Message file missing id=" + mid);
|
||||
db.message().setMessageContent(mid, false);
|
||||
if (manual) {
|
||||
// Check message files
|
||||
Log.i("Checking message files");
|
||||
List<Long> mids = db.message().getMessageWithContent();
|
||||
for (Long mid : mids) {
|
||||
EntityMessage message = db.message().getMessage(mid);
|
||||
File file = message.getFile(context);
|
||||
if (!file.exists()) {
|
||||
Log.w("Message file missing id=" + mid);
|
||||
db.message().setMessageContent(mid, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check attachments files
|
||||
Log.i("Checking attachments files");
|
||||
List<Long> aids = db.attachment().getAttachmentAvailable();
|
||||
for (Long aid : aids) {
|
||||
EntityAttachment attachment = db.attachment().getAttachment(aid);
|
||||
File file = attachment.getFile(context);
|
||||
if (!file.exists()) {
|
||||
Log.w("Attachment file missing id=" + aid);
|
||||
db.attachment().setUnavailable(aid);
|
||||
// Check attachments files
|
||||
Log.i("Checking attachments files");
|
||||
List<Long> aids = db.attachment().getAttachmentAvailable();
|
||||
for (Long aid : aids) {
|
||||
EntityAttachment attachment = db.attachment().getAttachment(aid);
|
||||
File file = attachment.getFile(context);
|
||||
if (!file.exists()) {
|
||||
Log.w("Attachment file missing id=" + aid);
|
||||
db.attachment().setUnavailable(aid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue