From adcf9fd2a4fe1a519d78d2206cf11d6b3f03c438 Mon Sep 17 00:00:00 2001 From: Fraenkiman Date: Fri, 5 Apr 2024 21:04:12 +0200 Subject: [PATCH] Closes #80 ...all just copied, o ho, o ho. see https://github.com/flatpressblog/flatpress/blob/7f67bf347dce18914bbeb2bf072f23543f2fcc61/fp-plugins/lastcommentsadmin/plugin.lastcommentsadmin.php#L40 --- admin/panels/maintain/admin.maintain.php | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/admin/panels/maintain/admin.maintain.php b/admin/panels/maintain/admin.maintain.php index 92335b1..d9d0619 100755 --- a/admin/panels/maintain/admin.maintain.php +++ b/admin/panels/maintain/admin.maintain.php @@ -187,6 +187,33 @@ class admin_maintain_default extends AdminPanelAction { if (!file_exists(CACHE_DIR)) fs_mkdir(CACHE_DIR); + // rebuilds the list of recent comments if LastComments plugin is active + if (function_exists('plugin_lastcomments_cache')) { + $coms = Array(); + + $q = new FPDB_Query(array( + 'fullparse' => false, + 'start' => 0, + 'count' => -1 + ), null); + while ($q->hasmore()) { + list ($id, $e) = $q->getEntry(); + $obj = new comment_indexer($id); + foreach ($obj->getList() as $value) { + $coms [$value] = $id; + } + ksort($coms); + $coms = array_slice($coms, -LASTCOMMENTS_MAX); + } + foreach ($coms as $cid => $eid) { + $c = comment_parse($eid, $cid); + plugin_lastcomments_cache($eid, array( + $cid, + $c + )); + } + } + return PANEL_NOREDIRECT; } case 'phpinfo':