0001-create-and-activate-a-management-command-to-clean-au.patch
combo/apps/dashboard/management/commands/clean_autotiles.py | ||
---|---|---|
1 |
# combo - content management system |
|
2 |
# Copyright (C) 2014-2018 Entr'ouvert |
|
3 |
# |
|
4 |
# This program is free software: you can redistribute it and/or modify it |
|
5 |
# under the terms of the GNU Affero General Public License as published |
|
6 |
# by the Free Software Foundation, either version 3 of the License, or |
|
7 |
# (at your option) any later version. |
|
8 |
# |
|
9 |
# This program is distributed in the hope that it will be useful, |
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
# GNU Affero General Public License for more details. |
|
13 |
# |
|
14 |
# You should have received a copy of the GNU Affero General Public License |
|
15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 | ||
17 |
from django.core.management.base import BaseCommand |
|
18 |
from django.utils.timezone import now, timedelta |
|
19 | ||
20 |
from combo.data.models import ConfigJsonCell |
|
21 | ||
22 | ||
23 |
class Command(BaseCommand): |
|
24 |
help = 'Delete automatically created tile cells that are more than 2 days old' |
|
25 | ||
26 |
def handle(self, *args, **options): |
|
27 |
ConfigJsonCell.objects.filter(placeholder='_auto_tile', |
|
28 |
last_update_timestamp__lte=now() - timedelta(days=2)).delete() |
debian/combo.cron.hourly | ||
---|---|---|
5 | 5 |
/sbin/runuser -u combo /usr/bin/combo-manage -- tenant_command update_momo_manifest --all-tenants -v0 |
6 | 6 |
/sbin/runuser -u combo /usr/bin/combo-manage -- tenant_command update_index --remove --all-tenants -v0 |
7 | 7 |
/sbin/runuser -u combo /usr/bin/combo-manage -- tenant_command notify_payments --all-tenants -v0 |
8 |
/sbin/runuser -u combo /usr/bin/combo-manage -- tenant_command clean_autotiles --all-tenants -v0 |
|
8 |
- |