|
|
@ -113,6 +113,7 @@ public class WorkerCleanup extends Worker {
|
|
|
|
// Check message files
|
|
|
|
// Check message files
|
|
|
|
Log.i("Checking message files");
|
|
|
|
Log.i("Checking message files");
|
|
|
|
try (Cursor cursor = db.message().getMessageWithContent()) {
|
|
|
|
try (Cursor cursor = db.message().getMessageWithContent()) {
|
|
|
|
|
|
|
|
while (cursor.moveToNext()) {
|
|
|
|
long mid = cursor.getLong(0);
|
|
|
|
long mid = cursor.getLong(0);
|
|
|
|
EntityMessage message = db.message().getMessage(mid);
|
|
|
|
EntityMessage message = db.message().getMessage(mid);
|
|
|
|
if (message != null) {
|
|
|
|
if (message != null) {
|
|
|
@ -123,10 +124,12 @@ public class WorkerCleanup extends Worker {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check attachments files
|
|
|
|
// Check attachments files
|
|
|
|
Log.i("Checking attachments files");
|
|
|
|
Log.i("Checking attachments files");
|
|
|
|
try (Cursor cursor = db.attachment().getAttachmentAvailable()) {
|
|
|
|
try (Cursor cursor = db.attachment().getAttachmentAvailable()) {
|
|
|
|
|
|
|
|
while (cursor.moveToNext()) {
|
|
|
|
long aid = cursor.getLong(0);
|
|
|
|
long aid = cursor.getLong(0);
|
|
|
|
EntityAttachment attachment = db.attachment().getAttachment(aid);
|
|
|
|
EntityAttachment attachment = db.attachment().getAttachment(aid);
|
|
|
|
if (attachment != null) {
|
|
|
|
if (attachment != null) {
|
|
|
@ -137,6 +140,7 @@ public class WorkerCleanup extends Worker {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Delete old attachments
|
|
|
|
// Delete old attachments
|
|
|
|
if (cleanup_attachments) {
|
|
|
|
if (cleanup_attachments) {
|
|
|
@ -211,6 +215,15 @@ public class WorkerCleanup extends Worker {
|
|
|
|
|
|
|
|
|
|
|
|
// Cleanup message files
|
|
|
|
// Cleanup message files
|
|
|
|
Log.breadcrumb("worker", "cleanup", "message files");
|
|
|
|
Log.breadcrumb("worker", "cleanup", "message files");
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
File[] files = new File(context.getFilesDir(), "messages").listFiles();
|
|
|
|
|
|
|
|
for (File file : files) {
|
|
|
|
|
|
|
|
if (file.isDirectory())
|
|
|
|
|
|
|
|
cleanupMessageFiles(db, manual, file.listFiles());
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
cleanupMessageFiles(db, manual, new File[]{file});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
cleanupMessageFiles(db, manual, Helper.listFiles(new File(context.getFilesDir(), "messages")).toArray(new File[0]));
|
|
|
|
cleanupMessageFiles(db, manual, Helper.listFiles(new File(context.getFilesDir(), "messages")).toArray(new File[0]));
|
|
|
|
cleanupMessageFiles(db, manual, new File(context.getFilesDir(), "revision").listFiles());
|
|
|
|
cleanupMessageFiles(db, manual, new File(context.getFilesDir(), "revision").listFiles());
|
|
|
|
cleanupMessageFiles(db, manual, new File(context.getFilesDir(), "references").listFiles());
|
|
|
|
cleanupMessageFiles(db, manual, new File(context.getFilesDir(), "references").listFiles());
|
|
|
|