diff --git a/docs/admin/deployment/manual/index.rst b/docs/admin/deployment/manual/index.rst index 1bdaf7763..077338cac 100644 --- a/docs/admin/deployment/manual/index.rst +++ b/docs/admin/deployment/manual/index.rst @@ -224,6 +224,8 @@ For apache you can build on this: ProxyPassReverse / http://localhost:8327/ +Please note that `FALLBACK_MEDIA_SERVING` needs to be set to `True` in the ephios configuration when using apache. + Remember to replace all the domain names and certificate paths with your own. Make sure to use secure SSL settings. To obtain SSL certificates, you can use `certbot `_ with Let's Encrypt. diff --git a/ephios/core/services/health/healthchecks.py b/ephios/core/services/health/healthchecks.py index d806e3b20..828437996 100644 --- a/ephios/core/services/health/healthchecks.py +++ b/ephios/core/services/health/healthchecks.py @@ -1,4 +1,4 @@ -import os +import shutil from django.conf import settings from django.contrib.auth.models import Permission @@ -162,15 +162,7 @@ def check(self): # if under 100 MB are available, we consider this an error # if under 1 GB are available, we consider this a warning # otherwise, we consider this ok - try: - disk_usage = os.statvfs(settings.MEDIA_ROOT) - except AttributeError: - # not available on windows - return ( - HealthCheckStatus.UNKNOWN, - mark_safe(_("Disk space check not available.")), - ) - free_bytes = disk_usage.f_bavail * disk_usage.f_frsize + free_bytes = shutil.disk_usage(settings.MEDIA_ROOT).free MEGA = 1024 * 1024 if free_bytes < 100 * MEGA: return ( diff --git a/ephios/plugins/files/forms.py b/ephios/plugins/files/forms.py index de27b321d..fd1770887 100644 --- a/ephios/plugins/files/forms.py +++ b/ephios/plugins/files/forms.py @@ -22,6 +22,7 @@ def clean_file(self): _("The file is too large. There are only %(quota)s available."), params={"quota": filesizeformat(settings.GET_USERCONTENT_QUOTA())}, ) + return self.cleaned_data["file"] class EventAttachedDocumentForm(BasePluginFormMixin, Form): diff --git a/ephios/plugins/files/models.py b/ephios/plugins/files/models.py index 381ed58e1..62485f7ea 100644 --- a/ephios/plugins/files/models.py +++ b/ephios/plugins/files/models.py @@ -2,6 +2,7 @@ from django.db import models from ephios.core.models import Event +from ephios.modellogging.log import ModelFieldsLogConfig, register_model_for_logging class Document(models.Model): @@ -11,3 +12,14 @@ class Document(models.Model): def __str__(self): return str(self.title) + + +register_model_for_logging( + Document, + ModelFieldsLogConfig( + unlogged_fields=[ + "id", + "file", + ], + ), +) diff --git a/ephios/settings.py b/ephios/settings.py index 861e4e3b8..81db47cd8 100644 --- a/ephios/settings.py +++ b/ephios/settings.py @@ -1,6 +1,7 @@ import copy import datetime import os +import shutil from datetime import timedelta from email.utils import getaddresses from importlib import metadata @@ -325,12 +326,7 @@ def GET_USERCONTENT_URL(): def GET_USERCONTENT_QUOTA(): - try: - disk_usage = os.statvfs(MEDIA_ROOT) - return disk_usage.f_bavail * disk_usage.f_frsize - except AttributeError: - # not available on windows - return None + return shutil.disk_usage(MEDIA_ROOT).free # Guardian configuration