mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-08 15:55:31 +01:00
added sanity checker management command for manual execution #534
This commit is contained in:
parent
ed478a1d73
commit
8b2965d55b
6 changed files with 101 additions and 3 deletions
|
|
@ -2,6 +2,7 @@ import hashlib
|
|||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from tqdm import tqdm
|
||||
|
||||
from documents.models import Document
|
||||
|
||||
|
|
@ -38,7 +39,7 @@ class SanityFailedError(Exception):
|
|||
f"{message_string}\n\n===============\n\n")
|
||||
|
||||
|
||||
def check_sanity():
|
||||
def check_sanity(progress=False):
|
||||
messages = []
|
||||
|
||||
present_files = []
|
||||
|
|
@ -50,7 +51,12 @@ def check_sanity():
|
|||
if lockfile in present_files:
|
||||
present_files.remove(lockfile)
|
||||
|
||||
for doc in Document.objects.all():
|
||||
if progress:
|
||||
docs = tqdm(Document.objects.all())
|
||||
else:
|
||||
docs = Document.objects.all()
|
||||
|
||||
for doc in docs:
|
||||
# Check sanity of the thumbnail
|
||||
if not os.path.isfile(doc.thumbnail_path):
|
||||
messages.append(SanityError(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue