mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
Minor improvements (#1525)
* Minor improvements * Update posting_tpl.tpl * Update CHANGELOG.md * Updated * Update clean_pm.php * Update mysql.sql * Update mysql.sql * Update mysql.sql * Update mysql.sql * Update mysql.sql
This commit is contained in:
parent
f8d3d2721c
commit
3488c9cc28
8 changed files with 33 additions and 22 deletions
|
@ -14,5 +14,27 @@ if (!defined('BB_ROOT')) {
|
|||
$pm_days_keep = (int)$bb_cfg['pm_days_keep'];
|
||||
|
||||
if ($pm_days_keep !== 0) {
|
||||
DB()->query("DELETE FROM " . BB_PRIVMSGS . " WHERE privmsgs_date < " . (TIMENOW - 86400 * $pm_days_keep));
|
||||
$per_cycle = 20000;
|
||||
$row = DB()->fetch_row("SELECT MIN(privmsgs_id) AS start_id, MAX(privmsgs_id) AS finish_id FROM " . BB_PRIVMSGS);
|
||||
$start_id = (int)$row['start_id'];
|
||||
$finish_id = (int)$row['finish_id'];
|
||||
|
||||
while (true) {
|
||||
set_time_limit(600);
|
||||
$end_id = $start_id + $per_cycle - 1;
|
||||
|
||||
DB()->query("
|
||||
DELETE pm, pmt
|
||||
FROM " . BB_PRIVMSGS . " pm
|
||||
LEFT JOIN " . BB_PRIVMSGS_TEXT . " pmt ON(pmt.privmsgs_text_id = pm.privmsgs_id)
|
||||
WHERE pm.privmsgs_id BETWEEN $start_id AND $end_id
|
||||
AND pm.privmsgs_date < " . (TIMENOW - 86400 * $pm_days_keep) . "
|
||||
");
|
||||
|
||||
if ($end_id > $finish_id) {
|
||||
break;
|
||||
}
|
||||
|
||||
$start_id += $per_cycle;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue