diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 4760e88905..727154f0cb 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -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;
}
diff --git a/phpBB/language/en/lang_admin.php b/phpBB/language/en/lang_admin.php
index f16e2175cd..2e241ae194 100644
--- a/phpBB/language/en/lang_admin.php
+++ b/phpBB/language/en/lang_admin.php
@@ -108,9 +108,11 @@ $lang = array_merge($lang, array(
'log_search_index' => 'Re-indexed search system
%s',
'log_disallow_add' => 'Added disallowed username
%s',
'log_disallow_delete' => 'Deleted disallowed username',
- 'log_prune' => 'Pruned forum
%s',
'log_admin_clear' => 'Cleared admin log',
+ 'LOG_PRUNE' => 'Pruned forums
» %s',
+ 'LOG_AUTO_PRUNE' => 'Auto-pruned forums
» %s',
+
'LOG_BAN_EXCLUDE_USER' => 'Excluded user from ban for reason %s
» %s ',
'LOG_BAN_EXCLUDE_IP' => 'Excluded ip from ban for reason %s
» %s ',
'LOG_BAN_EXCLUDE_EMAIL' => 'Excluded email from ban for reason %s
» %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',
diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php
index df1941a2b3..0a5fa36205 100644
--- a/phpBB/language/en/lang_main.php
+++ b/phpBB/language/en/lang_main.php
@@ -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',