feat(log action): Show torrent delete action (#2061)

* feat(log action): Show `torrent delete` action

* Update Torrent.php

* Update admin_log.php
This commit is contained in:
Roman Kelesidis 2025-07-28 20:15:14 +03:00 committed by GitHub
commit f80cad0c6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 1 deletions

View file

@ -229,6 +229,7 @@ if ($log_rowset) {
case $log_type['mod_topic_change_tor_type']:
case $log_type['mod_topic_tor_unregister']:
case $log_type['mod_topic_tor_register']:
case $log_type['mod_topic_tor_delete']:
case $log_type['mod_topic_renamed']:
case $log_type['mod_post_delete']:
case $log_type['mod_post_pin']:

View file

@ -2824,6 +2824,7 @@ $lang['LOG_ACTION']['LOG_TYPE'] = [
'mod_topic_change_tor_type' => 'Topic:<br /> <b>changed torrent type</b>',
'mod_topic_tor_unregister' => 'Topic:<br /> <b>torrent unregistered</b>',
'mod_topic_tor_register' => 'Topic:<br /> <b>torrent registered</b>',
'mod_topic_tor_delete' => 'Topic:<br /> <b>torrent deleted</b>',
'mod_topic_renamed' => 'Topic:<br /> <b>renamed</b>',
'mod_post_delete' => 'Post:<br /> <b>deleted</b>',
'mod_post_pin' => 'Post:<br /> <b>pinned</b>',

View file

@ -34,6 +34,7 @@ class LogAction
'mod_topic_change_tor_type' => 16,
'mod_topic_tor_unregister' => 17,
'mod_topic_tor_register' => 18,
'mod_topic_tor_delete' => 19,
];
public $log_type_select = [];
public $log_disabled = false;

View file

@ -181,7 +181,7 @@ class Torrent
*/
public static function delete_torrent($attach_id, $mode = '')
{
global $lang, $reg_mode, $topic_id;
global $lang, $reg_mode, $topic_id, $log_action;
$attach_id = (int)$attach_id;
$reg_mode = $mode;
@ -201,6 +201,13 @@ class Torrent
self::torrent_auth_check($forum_id, $poster_id);
self::tracker_unregister($attach_id);
delete_attachment(0, $attach_id);
// Log action
$log_action->mod('mod_topic_tor_delete', [
'forum_id' => $torrent['forum_id'],
'topic_id' => $torrent['topic_id'],
'topic_title' => $torrent['topic_title'],
]);
}
/**