aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2003-05-08 01:14:14 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2003-05-08 01:14:14 +0000
commit711d90b44ff23b5bc9ad63382f0251ca8ef30491 (patch)
tree3237f7b1dce32ee368176b8d395fdefed912be58 /phpBB/includes/functions_admin.php
parentbb373ebcba8d4ea15e617cd7edbfd54681712fcc (diff)
downloadforums-711d90b44ff23b5bc9ad63382f0251ca8ef30491.tar
forums-711d90b44ff23b5bc9ad63382f0251ca8ef30491.tar.gz
forums-711d90b44ff23b5bc9ad63382f0251ca8ef30491.tar.bz2
forums-711d90b44ff23b5bc9ad63382f0251ca8ef30491.tar.xz
forums-711d90b44ff23b5bc9ad63382f0251ca8ef30491.zip
Changed forum_link_track to forum_flags for storage of additional info [ pruning related ], moved lang selection into DB, other minor changes, still working on admin_prune, per forum styling for posting
git-svn-id: file:///svn/phpbb/trunk@3989 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r--phpBB/includes/functions_admin.php54
1 files changed, 40 insertions, 14 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index c14f105f41..4760e88905 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -1059,22 +1059,26 @@ function verify_data($type, $fieldname, &$need_update, &$data)
}
}
-function prune($forum_id, $prune_date = '', $auto_sync = TRUE)
+function prune($forum_id, $prune_date, $prune_flags = 0, $auto_sync = true)
{
global $db;
- // Those without polls ...
- // NOTE: can't remember why only those without polls :) -- Ashe
- $sql = 'SELECT topic_id
- FROM ' . TOPICS_TABLE . "
- WHERE t.forum_id = $forum_id
- AND poll_start = 0
- AND t.topic_type <> " . POST_ANNOUNCE;
-
- if ($prune_date != '')
+ $sql_and = '';
+ if (!($prune_flags & 4))
+ {
+ $sql_and .= ' AND topic_type <> ' . POST_ANNOUNCE;
+ }
+ if (!($prune_flags & 8))
{
- $sql .= ' AND topic_last_post_time < ' . $prune_date;
+ $sql_and .= ' AND topic_type <> ' . POST_STICKY;
}
+
+ $sql = 'SELECT topic_id
+ FROM ' . TOPICS_TABLE . "
+ WHERE forum_id = $forum_id
+ AND topic_last_post_time < $prune_date
+ AND poll_start = 0
+ $sql_and";
$result = $db->sql_query($sql);
$topic_list = array();
@@ -1084,18 +1088,40 @@ function prune($forum_id, $prune_date = '', $auto_sync = TRUE)
}
$db->sql_freeresult($result);
+ if ($prune_flags & 2)
+ {
+ $sql = 'SELECT topic_id
+ FROM ' . TOPICS_TABLE . "
+ WHERE forum_id = $forum_id
+ AND poll_start > 0
+ AND poll_last_vote < $prune_date
+ AND topic_last_post_time < $prune_date
+ $sql_and";
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $topic_list[] = $row['topic_id'];
+ }
+ $db->sql_freeresult($result);
+
+ $topic_list = array_unique($topic_list);
+ }
+
return delete_topics('topic_id', $topic_list, $auto_sync);
}
// Function auto_prune(), this function now relies on passed vars
-function auto_prune($forum_id, $prune_days, $prune_freq)
+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($forum_id, $prune_date, $prune_flags, true);
- $sql = "UPDATE " . FORUMS_TABLE . "
+ $sql = 'UPDATE ' . FORUMS_TABLE . "
SET prune_next = $next_prune
WHERE forum_id = $forum_id";
$db->sql_query($sql);