Prune related

git-svn-id: file:///svn/phpbb/trunk@3992 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-05-08 12:49:16 +00:00
parent 6a29503a13
commit 13da69d625
3 changed files with 30 additions and 15 deletions

View file

@ -344,7 +344,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = TRUE)
$db->sql_transaction('commit');
delete_attachment($post_ids);
// delete_attachment($post_ids);
if ($auto_sync)
{
@ -1063,6 +1063,8 @@ function prune($forum_id, $prune_date, $prune_flags = 0, $auto_sync = true)
{
global $db;
$sql_forum = (is_array($forum_id)) ? ' IN (' . implode(',', $forum_id) . ')' : " = $forum_id";
$sql_and = '';
if (!($prune_flags & 4))
{
@ -1075,7 +1077,7 @@ function prune($forum_id, $prune_date, $prune_flags = 0, $auto_sync = true)
$sql = 'SELECT topic_id
FROM ' . TOPICS_TABLE . "
WHERE forum_id = $forum_id
WHERE forum_id $sql_forum
AND topic_last_post_time < $prune_date
AND poll_start = 0
$sql_and";
@ -1092,7 +1094,7 @@ function prune($forum_id, $prune_date, $prune_flags = 0, $auto_sync = true)
{
$sql = 'SELECT topic_id
FROM ' . TOPICS_TABLE . "
WHERE forum_id = $forum_id
WHERE forum_id $sql_forum
AND poll_start > 0
AND poll_last_vote < $prune_date
AND topic_last_post_time < $prune_date
@ -1116,15 +1118,26 @@ function auto_prune($forum_id, $prune_flags, $prune_days, $prune_freq)
{
global $db;
$prune_date = time() - ($prune_days * 86400);
$next_prune = time() + ($prune_freq * 86400);
prune($forum_id, $prune_date, $prune_flags, true);
$sql = 'UPDATE ' . FORUMS_TABLE . "
SET prune_next = $next_prune
$sql = 'SELECT forum_name
FROM ' . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
$db->sql_query($sql);
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
$prune_date = time() - ($prune_days * 86400);
$next_prune = time() + ($prune_freq * 86400);
prune($forum_id, $prune_date, $prune_flags, true);
$sql = 'UPDATE ' . FORUMS_TABLE . "
SET prune_next = $next_prune
WHERE forum_id = $forum_id";
$db->sql_query($sql);
add_log('admin', 'LOG_AUTO_PRUNE', $row['forum_name']);
}
$db->sql_freeresult($result);
return;
}

View file

@ -108,9 +108,11 @@ $lang = array_merge($lang, array(
'log_search_index' => '<b>Re-indexed search system</b><br />%s',
'log_disallow_add' => '<b>Added disallowed username</b><br />%s',
'log_disallow_delete' => '<b>Deleted disallowed username</b>',
'log_prune' => '<b>Pruned forum</b><br />%s',
'log_admin_clear' => '<b>Cleared admin log</b>',
'LOG_PRUNE' => '<b>Pruned forums</b><br />&#187; %s',
'LOG_AUTO_PRUNE' => '<b>Auto-pruned forums</b><br />&#187; %s',
'LOG_BAN_EXCLUDE_USER' => '<b>Excluded user from ban</b> for reason %s<br />&#187; %s ',
'LOG_BAN_EXCLUDE_IP' => '<b>Excluded ip from ban</b> for reason %s<br />&#187; %s ',
'LOG_BAN_EXCLUDE_EMAIL' => '<b>Excluded email from ban</b> for reason %s<br />&#187; %s ',
@ -796,9 +798,8 @@ $lang = array_merge($lang, array(
'FORUM_PRUNE_EXPLAIN' => 'This will delete any topic which has not been posted to within the number of days you select. If you do not enter a number then all topics will be deleted. It will not remove topics in which polls are still running nor will it remove announcements. You will need to remove these topics manually.',
'DO_PRUNE' => 'Do Prune',
'ALL_FORUMS' => 'All Forums',
'PRUNE_NOT_POSTED' => 'Prune topics with no replies in %s days',
'PRUNE_NOT_POSTED' => 'Days since last posted',
'TOPICS_PRUNED' => 'Topics pruned',
'POSTS_PRUNED' => 'Posts pruned',
'PRUNE_SUCCESS' => 'Pruning of forums was successful',

View file

@ -245,6 +245,7 @@ $lang = array(
'G_REGISTERED' => 'REGISTERED USERS',
'G_INACTIVE' => 'INACTIVE USERS',
'G_GUESTS' => 'GUESTS',
'G_BANNED' => 'BANNED',
'NO_NEW_POSTS' => 'No new posts',
'NEW_POSTS' => 'New posts',