feat(log action): Show torrent register action (#2060)

* feat(log action): Show torrent register action

* Update main.php

* Update admin_log.php
This commit is contained in:
Roman Kelesidis 2025-07-28 19:40:42 +03:00 committed by GitHub
commit 66c01a591f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 16 additions and 8 deletions

View file

@ -228,6 +228,7 @@ if ($log_rowset) {
case $log_type['mod_topic_change_tor_status']:
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_renamed']:
case $log_type['mod_post_delete']:
case $log_type['mod_post_pin']:

View file

@ -68,11 +68,21 @@ switch ($type) {
case 'reg':
\TorrentPier\Legacy\Torrent::tracker_register($attach_id);
$log_action->mod('mod_topic_tor_register', [
'forum_id' => $torrent['forum_id'],
'topic_id' => $torrent['topic_id'],
'topic_title' => $torrent['topic_title'],
]);
$url = (TOPIC_URL . $torrent['topic_id']);
break;
case 'unreg':
\TorrentPier\Legacy\Torrent::tracker_unregister($attach_id);
$log_action->mod('mod_topic_tor_unregister', [
'forum_id' => $torrent['forum_id'],
'topic_id' => $torrent['topic_id'],
'topic_title' => $torrent['topic_title'],
]);
$url = (TOPIC_URL . $torrent['topic_id']);
break;

View file

@ -2823,6 +2823,7 @@ $lang['LOG_ACTION']['LOG_TYPE'] = [
'mod_topic_change_tor_status' => 'Topic:<br /> <b>changed torrent status</b>',
'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_renamed' => 'Topic:<br /> <b>renamed</b>',
'mod_post_delete' => 'Post:<br /> <b>deleted</b>',
'mod_post_pin' => 'Post:<br /> <b>pinned</b>',

View file

@ -479,6 +479,8 @@ class Attach
unlink_attach($row['physical_filename'], MODE_THUMBNAIL);
}
// todo: log action - torrent updated
//bt
if ($this->attachment_extension_list[$actual_element] === TORRENT_EXT && $attachments[$actual_element]['tracker_status']) {
Torrent::tracker_unregister($attachment_id);

View file

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

View file

@ -97,7 +97,7 @@ class Torrent
*/
public static function tracker_unregister($attach_id, $mode = '')
{
global $lang, $bb_cfg, $log_action;
global $lang, $bb_cfg;
$attach_id = (int)$attach_id;
$post_id = $topic_id = $topic_title = $forum_id = null;
@ -153,13 +153,6 @@ class Torrent
$torrServer->removeM3U($attach_id);
}
// Log action
$log_action->mod('mod_topic_tor_unregister', [
'forum_id' => $forum_id,
'topic_id' => $topic_id,
'topic_title' => $topic_title,
]);
// Delete torrent
$sql = "DELETE FROM " . BB_BT_TORRENTS . " WHERE attach_id = $attach_id";