Fixed $bb_cfg['pm_days_keep'] (#834)

This commit is contained in:
Roman Kelesidis 2023-07-20 23:08:45 +07:00 committed by GitHub
commit fbf5bf94f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 1 deletions

View file

@ -624,6 +624,7 @@ VALUES ('1', 'Attach maintenance', 'attach_maintenance.php', 'daily', '', '05:00
'0',
'1', '0'),
('1', 'Logs cleanup', 'clean_log.php', 'daily', '', '05:00:00', '70', '', '', '', '1', '', '0', '1', '0'),
('1', 'PM cleanup', 'clean_pm.php', 'daily', '', '05:00:00', '70', '', '', '', '1', '', '0', '1', '0'),
('1', 'Tracker maintenance', 'tr_maintenance.php', 'daily', '', '05:00:00', '90', '', '', '', '1', '', '0', '1',
'0'),
('1', 'Clean dlstat', 'clean_dlstat.php', 'daily', '', '05:00:00', '100', '', '', '', '1', '', '0', '1', '0'),

View file

@ -60,3 +60,6 @@ ALTER TABLE `bb_users` CHANGE `user_newpasswd` `user_newpasswd` VARCHAR(255) NOT
// 2.4.0-alpha3
INSERT INTO bb_config VALUES ('show_board_start_index', '1');
// 2.4.0-beta2
INSERT INTO `bb_cron` VALUES (NULL, '1', 'PM cleanup', 'clean_pm.php', 'daily', '', '05:00:00', '70', '', '', '', '1', '', '0', '1', '0');

View file

@ -493,7 +493,7 @@ $bb_cfg['max_savebox_privmsgs'] = 500; // максимальное число с
$bb_cfg['max_sentbox_privmsgs'] = 500; // максимальное число сообщений в папке отправленные
$bb_cfg['max_smilies_pm'] = 15; // максимальное число смайлов в сообщении (0 - без ограничения)
$bb_cfg['max_symbols_pm'] = 1500; // TODO: максимальное число символов в сообщении (0 - без ограничения)
$bb_cfg['pm_days_keep'] = 180; // TODO: время хранения ЛС
$bb_cfg['pm_days_keep'] = 180; // время хранения ЛС
// Actions log
$bb_cfg['log_days_keep'] = 365; // время хранения истории действий

View file

@ -0,0 +1,19 @@
<?php
/**
* TorrentPier Bull-powered BitTorrent tracker engine
*
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
$pm_days_keep = (int)$bb_cfg['pm_days_keep'];
DB()->query("
DELETE FROM " . BB_PRIVMSGS . "
WHERE privmsgs_date < " . (TIMENOW - 86400 * $pm_days_keep) . "
");