Make get_torrent_info() as public method for re-use (#1697)

* Make `get_torrent_info()` as public method for re-use

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2024-12-02 23:11:44 +07:00 committed by GitHub
commit 2ae9f72c1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 23 deletions

View file

@ -22,6 +22,7 @@
- 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))
- Demo mode: Save user language in cookies [\#1584](https://github.com/torrentpier/torrentpier/pull/1584) ([belomaxorka](https://github.com/belomaxorka))
- Make `get_torrent_info()` as public method for re-use [\#1697](https://github.com/torrentpier/torrentpier/pull/1697) ([belomaxorka](https://github.com/belomaxorka))
- BBCode: Fixed relative links working [\#1613](https://github.com/torrentpier/torrentpier/pull/1613) ([belomaxorka](https://github.com/belomaxorka))
- Fixed empty `topic_id` in log actions after topic rename [\#1687](https://github.com/torrentpier/torrentpier/pull/1687) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken torrent stats displaying [\#1672](https://github.com/torrentpier/torrentpier/pull/1672), [\#1673](https://github.com/torrentpier/torrentpier/pull/1673) ([belomaxorka](https://github.com/belomaxorka))

View file

@ -19,31 +19,11 @@ if (!isset($this->request['attach_id'])) {
if (!isset($this->request['type'])) {
$this->ajax_die('empty type');
}
$attach_id = (int)$this->request['attach_id'];
$type = (string)$this->request['type'];
$torrent = DB()->fetch_row("
SELECT
a.post_id, d.physical_filename, d.extension, d.tracker_status,
t.topic_first_post_id, t.topic_title,
p.poster_id, p.topic_id, p.forum_id,
f.allow_reg_tracker
FROM
" . BB_ATTACHMENTS . " a,
" . BB_ATTACHMENTS_DESC . " d,
" . BB_POSTS . " p,
" . BB_TOPICS . " t,
" . BB_FORUMS . " f
WHERE
a.attach_id = $attach_id
AND d.attach_id = $attach_id
AND p.post_id = a.post_id
AND t.topic_id = p.topic_id
AND f.forum_id = p.forum_id
LIMIT 1
");
if (!$torrent) {
if (!$torrent = \TorrentPier\Legacy\Torrent::get_torrent_info($attach_id)) {
$this->ajax_die($lang['INVALID_ATTACH_ID']);
}

View file

@ -29,7 +29,7 @@ class Torrent
*
* @return array
*/
private static function get_torrent_info($attach_id)
public static function get_torrent_info($attach_id)
{
global $lang;