aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2003-05-08 12:49:16 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2003-05-08 12:49:16 +0000
commit13da69d62545f1ff10a597cbf0777d5f7300b7ed (patch)
treef739f00893193ac10f515cb1b0282f042b17d86a
parent6a29503a135b8464571bfe858e22e78841744c5c (diff)
downloadforums-13da69d62545f1ff10a597cbf0777d5f7300b7ed.tar
forums-13da69d62545f1ff10a597cbf0777d5f7300b7ed.tar.gz
forums-13da69d62545f1ff10a597cbf0777d5f7300b7ed.tar.bz2
forums-13da69d62545f1ff10a597cbf0777d5f7300b7ed.tar.xz
forums-13da69d62545f1ff10a597cbf0777d5f7300b7ed.zip
Prune related
git-svn-id: file:///svn/phpbb/trunk@3992 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/includes/functions_admin.php33
-rw-r--r--phpBB/language/en/lang_admin.php9
-rw-r--r--phpBB/language/en/lang_main.php1
3 files changed, 29 insertions, 14 deletions
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);
+ $sql = 'SELECT forum_name
+ FROM ' . FORUMS_TABLE . "
+ WHERE forum_id = $forum_id";
+ $result = $db->sql_query($sql);
- prune($forum_id, $prune_date, $prune_flags, true);
+ if ($row = $db->sql_fetchrow($result))
+ {
+ $prune_date = time() - ($prune_days * 86400);
+ $next_prune = time() + ($prune_freq * 86400);
- $sql = 'UPDATE ' . FORUMS_TABLE . "
- SET prune_next = $next_prune
- WHERE forum_id = $forum_id";
- $db->sql_query($sql);
+ 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' => '<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',
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',