Show torrent unregister action in log actions (#1696)

* Show torrent unregister action in log actions

* Update LogAction.php

* Update CHANGELOG.md

* Update main.php

* Update main.php
This commit is contained in:
Roman Kelesidis 2024-12-02 18:11:52 +07:00 committed by GitHub
commit 47e8c9a7ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 3 deletions

View file

@ -17,6 +17,7 @@
- Improved BitTorrent clients ban functionality [\#1657](https://github.com/torrentpier/torrentpier/pull/1657) ([belomaxorka](https://github.com/belomaxorka))
- Improved `filelist.php` [\#1586](https://github.com/torrentpier/torrentpier/pull/1586) ([belomaxorka](https://github.com/belomaxorka))
- Invites: Permanent invites feature [\#1670](https://github.com/torrentpier/torrentpier/pull/1670) ([belomaxorka](https://github.com/belomaxorka))
- Show torrent unregister action in log actions [\#1696](https://github.com/torrentpier/torrentpier/pull/1696) ([belomaxorka](https://github.com/belomaxorka))
- Show torrent status changes in actions log [\#1688](https://github.com/torrentpier/torrentpier/pull/1688) ([belomaxorka](https://github.com/belomaxorka))
- Show torrent type (gold / silver) changes in actions log [\#1689](https://github.com/torrentpier/torrentpier/pull/1689) ([belomaxorka](https://github.com/belomaxorka))
- Changed database encoding to `utf8mb4_unicode_ci` [\#1684](https://github.com/torrentpier/torrentpier/pull/1684) ([belomaxorka](https://github.com/belomaxorka))

View file

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

View file

@ -2815,6 +2815,7 @@ $lang['LOG_ACTION']['LOG_TYPE'] = [
'mod_topic_unset_downloaded' => 'Topic:<br /> <b>unset downloaded</b>',
'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_renamed' => 'Topic:<br /> <b>renamed</b>',
'mod_post_delete' => 'Post:<br /> <b>deleted</b>',
'mod_post_pin' => 'Post:<br /> <b>pinned</b>',

View file

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

View file

@ -38,7 +38,7 @@ class Torrent
$sql = "
SELECT
a.post_id, d.physical_filename, d.extension, d.tracker_status, d.mimetype,
t.topic_first_post_id,
t.topic_first_post_id, t.topic_title,
p.poster_id, p.topic_id, p.forum_id,
f.allow_reg_tracker
FROM
@ -97,16 +97,17 @@ class Torrent
*/
public static function tracker_unregister($attach_id, $mode = '')
{
global $lang, $bb_cfg;
global $lang, $bb_cfg, $log_action;
$attach_id = (int)$attach_id;
$post_id = $topic_id = $forum_id = $info_hash = null;
$post_id = $topic_id = $topic_title = $forum_id = $info_hash = null;
// Get torrent info
if ($torrent = self::get_torrent_info($attach_id)) {
$post_id = $torrent['post_id'];
$topic_id = $torrent['topic_id'];
$forum_id = $torrent['forum_id'];
$topic_title = $torrent['topic_title'];
}
if ($mode == 'request') {
@ -152,6 +153,13 @@ 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,
]);
// Ocelot
if ($bb_cfg['ocelot']['enabled']) {
if ($row = DB()->fetch_row("SELECT info_hash FROM " . BB_BT_TORRENTS . " WHERE attach_id = $attach_id LIMIT 1")) {