From 0317664383cbd7bbfc76b8c98b9da945b99d2e70 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Thu, 1 Feb 2024 00:13:48 +0700 Subject: [PATCH] Moved announcer url autofill into cron (#1364) * Moved announcer autofill into cron * Update CHANGELOG.md --- CHANGELOG.md | 1 + library/includes/cron/jobs/board_maintenance.php | 13 +++++++++---- library/includes/init_bb.php | 5 ----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddec173fc..7815b53f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - Added `bt_announce_url` autofill [\#1331](https://github.com/torrentpier/torrentpier/pull/1331) ([belomaxorka](https://github.com/belomaxorka)) - Added "Random release" button in tracker.php [\#1334](https://github.com/torrentpier/torrentpier/pull/1334) ([belomaxorka](https://github.com/belomaxorka)) - Added support for fastly cdn [\#1327](https://github.com/torrentpier/torrentpier/pull/1327) ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky)) +- Moved announcer url autofill into cron [\#1364](https://github.com/torrentpier/torrentpier/pull/1364) ([belomaxorka](https://github.com/belomaxorka)) - Use `target="_blank"` in admin for profile_url() redirects [\#1330](https://github.com/torrentpier/torrentpier/pull/1330) ([belomaxorka](https://github.com/belomaxorka)) - Used declensions for days in some cases [\#1310](https://github.com/torrentpier/torrentpier/pull/1310) ([belomaxorka](https://github.com/belomaxorka)) - Used `modern-normalize` instead of outdated `nornalize-css` [\#1363](https://github.com/torrentpier/torrentpier/pull/1363) ([belomaxorka](https://github.com/belomaxorka)) diff --git a/library/includes/cron/jobs/board_maintenance.php b/library/includes/cron/jobs/board_maintenance.php index b3fb049a9..d4312f5e6 100644 --- a/library/includes/cron/jobs/board_maintenance.php +++ b/library/includes/cron/jobs/board_maintenance.php @@ -11,12 +11,12 @@ if (!defined('BB_ROOT')) { die(basename(__FILE__)); } -// Синхронизация +// Synchronization \TorrentPier\Legacy\Admin\Common::sync('topic', 'all'); \TorrentPier\Legacy\Admin\Common::sync('user_posts', 'all'); \TorrentPier\Legacy\Admin\Common::sync_all_forums(); -// Чистка bb_poll_users +// Cleaning bb_poll_users if ($poll_max_days = (int)$bb_cfg['poll_max_days']) { $per_cycle = 20000; $row = DB()->fetch_row("SELECT MIN(topic_id) AS start_id, MAX(topic_id) AS finish_id FROM " . BB_POLL_USERS); @@ -41,10 +41,15 @@ if ($poll_max_days = (int)$bb_cfg['poll_max_days']) { } } -// Чистка user_newpasswd +// Cleaning user_newpasswd DB()->query("UPDATE " . BB_USERS . " SET user_newpasswd = '' WHERE user_lastvisit < " . (TIMENOW - 7 * 86400)); -// Чистка кеша постов +// Cleaning post cache if ($posts_days = (int)$bb_cfg['posts_cache_days_keep']) { DB()->query("DELETE FROM " . BB_POSTS_HTML . " WHERE post_html_time < DATE_SUB(NOW(), INTERVAL $posts_days DAY)"); } + +// Autofill announcer url +if (empty($bb_cfg['bt_announce_url'])) { + bb_update_config(['bt_announce_url' => FULL_URL . 'bt/announce.php']); +} diff --git a/library/includes/init_bb.php b/library/includes/init_bb.php index 25059af69..323664e7c 100644 --- a/library/includes/init_bb.php +++ b/library/includes/init_bb.php @@ -394,11 +394,6 @@ $user = new TorrentPier\Legacy\Common\User(); $userdata =& $user->data; -// Set announcer default URL -if (empty($bb_cfg['bt_announce_url'])) { - bb_update_config(['bt_announce_url' => FULL_URL . 'bt/announce.php']); -} - /** * Cron */