From de12cb569d10ee2a04b38b079a3b69b20b6718b7 Mon Sep 17 00:00:00 2001 From: neptune Date: Sat, 17 Dec 2022 03:47:35 -0300 Subject: Agregada funcionalidad de basural --- cgi/manage.py | 7 +++++++ cgi/post.py | 9 +++++++++ cgi/templates/manage/rebuild.html | 1 + 3 files changed, 17 insertions(+) (limited to 'cgi') diff --git a/cgi/manage.py b/cgi/manage.py index 03963e7..2fef8ca 100644 --- a/cgi/manage.py +++ b/cgi/manage.py @@ -127,6 +127,13 @@ def manage(self, path_split): 'board': _('news'), 'time': timeTaken(t1, time.time())} logAction(staff_account['username'], _( 'Rebuilt %s') % _('news')) + elif board_dir == '!TRASH': + t1 = time.time() + regenerateTrash() + message = _('Rebuilt %(board)s in %(time)s seconds.') % { + 'board': _('trash'), 'time': timeTaken(t1, time.time())} + logAction(staff_account['username'], _( + 'Rebuilt %s') % _('trash')) elif board_dir == '!KAKO': t1 = time.time() boards = FetchAll( diff --git a/cgi/post.py b/cgi/post.py index 07b05bc..cb531dd 100644 --- a/cgi/post.py +++ b/cgi/post.py @@ -1111,6 +1111,15 @@ def regenerateNews(): finally: f.close() +def regenerateTrash(): + posts = FetchAll("SELECT posts.id AS id, timestamp_formatted, posts.message AS message, boards.name AS board FROM `posts` INNER JOIN `boards` ON boardid = boards.id WHERE IS_DELETED = 2 ORDER BY `timestamp` DESC") + template_values = {'posts': posts} + + page_rendered = renderTemplate('trash.html', template_values) + + with open(Settings.HOME_DIR + "basural.html", "w") as f: + f.write(page_rendered) + def regenerateAccess(): if not Settings.HTACCESS_GEN: return False diff --git a/cgi/templates/manage/rebuild.html b/cgi/templates/manage/rebuild.html index 3afc057..05ce845 100644 --- a/cgi/templates/manage/rebuild.html +++ b/cgi/templates/manage/rebuild.html @@ -6,6 +6,7 @@ SecciónAcción Home[Reconstruir] Noticias[Reconstruir] + Basural[Reconstruir] Índices de archivos[Reconstruir] .htaccess[Reconstruir] -- cgit v1.2.1-18-gbd029