From 7a67fefd4d844d0d7fae2d42669e912a746ce119 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sat, 24 Aug 2024 22:09:27 +0700 Subject: [PATCH] Minor improvements (#1611) * Minor improvements * Update displaying_torrent.php * Update TorrServerAPI.php * Update CHANGELOG.md --- CHANGELOG.md | 4 ++-- library/attach_mod/displaying_torrent.php | 4 ++-- src/TorrServerAPI.php | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52111acb8..9d97bda75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,8 +16,8 @@ - Demo mode: Save user language in cookies [\#1584](https://github.com/torrentpier/torrentpier/pull/1584) ([belomaxorka](https://github.com/belomaxorka)) - Fixed `md5()` deprecated in PHP 8.4 [\#1561](https://github.com/torrentpier/torrentpier/pull/1561) ([belomaxorka](https://github.com/belomaxorka)) - Increased `USEREMAIL_MAX_LENGTH` [\#1566](https://github.com/torrentpier/torrentpier/pull/1566) ([belomaxorka](https://github.com/belomaxorka)) -- Minor improvements [\#1570](https://github.com/torrentpier/torrentpier/pull/1570), [\#1571](https://github.com/torrentpier/torrentpier/pull/1571), [\#1575](https://github.com/torrentpier/torrentpier/pull/1575), [\#1589](https://github.com/torrentpier/torrentpier/pull/1589), [\#1592](https://github.com/torrentpier/torrentpier/pull/1592), [\#1605](https://github.com/torrentpier/torrentpier/pull/1605) ([belomaxorka](https://github.com/belomaxorka)) -- Updated deps [\#1563](https://github.com/torrentpier/torrentpier/pull/1563), [\#1564](https://github.com/torrentpier/torrentpier/pull/1564), [\#1608](https://github.com/torrentpier/torrentpier/pull/1608) ([belomaxorka](https://github.com/belomaxorka)) +- Minor improvements [\#1570](https://github.com/torrentpier/torrentpier/pull/1570), [\#1571](https://github.com/torrentpier/torrentpier/pull/1571), [\#1575](https://github.com/torrentpier/torrentpier/pull/1575), [\#1589](https://github.com/torrentpier/torrentpier/pull/1589), [\#1592](https://github.com/torrentpier/torrentpier/pull/1592), [\#1605](https://github.com/torrentpier/torrentpier/pull/1605), [\#1611](https://github.com/torrentpier/torrentpier/pull/1611) ([belomaxorka](https://github.com/belomaxorka)) +- Updated deps [\#1563](https://github.com/torrentpier/torrentpier/pull/1563), [\#1564](https://github.com/torrentpier/torrentpier/pull/1564), [\#1608](https://github.com/torrentpier/torrentpier/pull/1608), [\#1609](https://github.com/torrentpier/torrentpier/pull/1609), [\#1610](https://github.com/torrentpier/torrentpier/pull/1610) ([belomaxorka](https://github.com/belomaxorka)) - New Crowdin updates [\#1569](https://github.com/torrentpier/torrentpier/pull/1569), [\#1572](https://github.com/torrentpier/torrentpier/pull/1572), [\#1573](https://github.com/torrentpier/torrentpier/pull/1573), [\#1574](https://github.com/torrentpier/torrentpier/pull/1574), [\#1588](https://github.com/torrentpier/torrentpier/pull/1588), [\#1590](https://github.com/torrentpier/torrentpier/pull/1590), [\#1600](https://github.com/torrentpier/torrentpier/pull/1600), [\#1601](https://github.com/torrentpier/torrentpier/pull/1601), [\#1606](https://github.com/torrentpier/torrentpier/pull/1606), [\#1607](https://github.com/torrentpier/torrentpier/pull/1607) ([Exileum](https://github.com/Exileum)) ## [v2.4.4](https://github.com/torrentpier/torrentpier/tree/v2.4.4) (2024-07-22) diff --git a/library/attach_mod/displaying_torrent.php b/library/attach_mod/displaying_torrent.php index 8ccaeb2fa..0d1126c84 100644 --- a/library/attach_mod/displaying_torrent.php +++ b/library/attach_mod/displaying_torrent.php @@ -224,9 +224,9 @@ if ($tor_reged && $tor_info) { ]); // TorrServer integration - if ($bb_cfg['torr_server']['enabled']) { + if ($bb_cfg['torr_server']['enabled'] && $m3u_file = (new \TorrentPier\TorrServerAPI())->getM3UPath($attach_id)) { $template->assign_block_vars('postrow.attach.tor_reged.tor_server', [ - 'TORR_SERVER_M3U_LINK' => (new \TorrentPier\TorrServerAPI())->getM3UPath($attach_id), + 'TORR_SERVER_M3U_LINK' => $m3u_file, 'TORR_SERVER_M3U_ICON' => $images['icon_tor_m3u_icon'], ]); } diff --git a/src/TorrServerAPI.php b/src/TorrServerAPI.php index eb2ae1e16..c16488227 100644 --- a/src/TorrServerAPI.php +++ b/src/TorrServerAPI.php @@ -168,7 +168,11 @@ class TorrServerAPI { $m3uFile = get_attachments_dir() . '/' . self::M3U['prefix'] . $attach_id . self::M3U['extension']; if (is_file($m3uFile)) { - return unlink($m3uFile); + if (unlink($m3uFile)) { + return true; + } else { + bb_log("TorrServer (ERROR) [removeM3U()]: Can't unlink file '$m3uFile'\n", $this->logFile); + } } return false;