aboutsummaryrefslogtreecommitdiff
path: root/cgi
diff options
context:
space:
mode:
authorLibravatar neptune 2022-12-17 03:47:35 -0300
committerLibravatar neptune 2022-12-17 03:47:35 -0300
commitde12cb569d10ee2a04b38b079a3b69b20b6718b7 (patch)
tree50403254946e396deac622499c858d5106e494b8 /cgi
parent2767ab7add47272192d78ac92592e4d3d18878a3 (diff)
downloadweabot-de12cb569d10ee2a04b38b079a3b69b20b6718b7.tar.gz
weabot-de12cb569d10ee2a04b38b079a3b69b20b6718b7.tar.xz
weabot-de12cb569d10ee2a04b38b079a3b69b20b6718b7.zip
Agregada funcionalidad de basural
Diffstat (limited to 'cgi')
-rw-r--r--cgi/manage.py7
-rw-r--r--cgi/post.py9
-rw-r--r--cgi/templates/manage/rebuild.html1
3 files changed, 17 insertions, 0 deletions
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 @@
<tr><th colspan="2">Sección</th><th colspan="2">Acción</th></tr>
<tr><td colspan="2"><b>Home</b></td><td colspan="2" style="text-align:center;">[<a href="#{cgi_url}manage/rebuild/!HOME">Reconstruir</a>]</td></tr>
<tr><td colspan="2"><b>Noticias</b></td><td colspan="2" style="text-align:center;">[<a href="#{cgi_url}manage/rebuild/!NEWS">Reconstruir</a>]</td></tr>
+ <tr><td colspan="2"><b>Basural</b></td><td colspan="2" style="text-align:center;">[<a href="#{cgi_url}manage/rebuild/!TRASH">Reconstruir</a>]</td></tr>
<tr><td colspan="2"><b>Índices de archivos</b></td><td colspan="2" style="text-align:center;">[<a href="#{cgi_url}manage/rebuild/!KAKO">Reconstruir</a>]</td></tr>
<tr><td colspan="2"><b>.htaccess</b></td><td colspan="2" style="text-align:center;">[<a href="#{cgi_url}manage/rebuild/!HTACCESS">Reconstruir</a>]</td></tr>
<?py for board in boards: ?>