0) ? time() - ($prune_days*86400) : -1; @set_time_limit(0); if ($prune_from == 'all') { $result = $db->query('SELECT id FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); $num_forums = $db->num_rows($result); for ($i = 0; $i < $num_forums; $i++) { $fid = $db->result($result, $i); prune($fid, $_POST['prune_sticky'], $prune_date); // start transaction update_forum($fid, PUN_TRANS_END); // end transaction } } else { prune($prune_from, $_POST['prune_sticky'], $prune_date); // start transaction update_forum($prune_from, PUN_TRANS_END); // end transaction } // Locate any "orphaned redirect topics" and delete them $result = $db->query('SELECT t1.id FROM '.$db->prefix.'topics AS t1 LEFT OUTER JOIN '.$db->prefix.'topics AS t2 ON t1.moved_to=t2.id WHERE t2.id IS NULL AND t1.moved_to IS NOT NULL') or error('Unable to fetch redirect topics', __FILE__, __LINE__, $db->error()); $num_orphans = $db->num_rows($result); if ($num_orphans) { for ($i = 0; $i < $num_orphans; $i++) $orphans[] = $db->result($result, $i); $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error()); } redirect('admin_prune.php', 'Posts pruned. Redirecting ...'); } else { $prune_days = $_POST['req_prune_days']; if (preg_match('/[^0-9]/', $prune_days)) message('Days to prune must be a positive integer.'); $prune_date = time() - ($prune_days*86400); $prune_from = $_POST['prune_from']; // Concatenate together the query for counting number or topics to prune $sql = 'SELECT COUNT(id) FROM '.$db->prefix.'topics WHERE last_post<'.$prune_date; if ($_POST['prune_sticky'] == '0') $sql .= ' AND sticky=\'0\''; if ($prune_from != 'all') { $sql .= ' AND forum_id='.$prune_from; // Fetch the forum name (just for cosmetic reasons) $result = $db->query('SELECT forum_name FROM '.$db->prefix.'forums WHERE id='.$prune_from) or error('Unable to fetch forum name', __FILE__, __LINE__, $db->error()); $forum = '"'.$db->result($result, 0).'"'; } else $forum = 'all forums'; $result = $db->query($sql) or error('Unable to fetch topic prune count', __FILE__, __LINE__, $db->error()); $num_topics = $db->result($result, 0); if (!$num_topics) message('There are no topics that are '.$prune_days.' days old. Please decrease the value of "Days old" and try again.'); $page_title = htmlspecialchars($options['board_title']).' / Admin / Prune'; require 'header.php'; admin_menu('prune'); ?>
Confirm prune posts

 Are you sure that you want to prune all topics older than days from ? ( topics)

 WARNING! Pruning posts deletes them permanently.

    Go back

 
Prune old posts
Prune  
Days old
The number of days "old" a topic must be to be pruned. E.g. if you were to enter 30, every topic that didn't contain a post from up til 30 days ago would be deleted.
Prune sticky topics
When enabled sticky topics will also be pruned.
 Yes    No
Prune from forum
The forum from which you want to prune posts.
Use this feature with caution. Pruned posts can never be recovered. For best performance you should put the forum in maintenance mode during pruning.