Version: 1.0.0, by Andreas
Developer Last Online: Jan 2023
Version: 3.5.0
Rating:
Released: 11-01-2005
Last Update: Never
Installs: 175
DB Changes Uses Plugins
No support by the author.
<font size="3">Auto Prune Threads</font>
Description
This hack gives you the ability to specify if you want to have
threads pruned from a forum after x days.
The amount of days can be set separately for each forum in forum manager.
Details
1 Product XML (3 Plugins, 1 Phrase)
Compatibility Note vBulletin 3.7
As of vBulletin 3.7 Beta 4, the hook used for this Mod does not exist any longer.
After installting this Mod, please change the Hook location to cron_script_cleanup_hourly
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
Does anyone know the function to move a thread? I rather have it move all the threads to a dedicated forum, then I can manually prune that single forum when my server is offline, since pruning is extremly CPU intensive when pruning thousands of threads.
- Disable or remove "Auto-Prune Threads" plugin in the plugin section
- Upload in your cron dir (includes/cron/) a php file (e.g. autoprune.php) with this code:
Code:
<?php
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
exit;
}
require_once(DIR . '/includes/functions_databuild.php');
$forums = $vbulletin->db->query_read("SELECT forumid, pruneafter FROM " . TABLE_PREFIX . "forum WHERE pruneafter > 0");
while ($forum = $vbulletin->db->fetch_array($forums))
{
$threads = $vbulletin->db->query_read("SELECT threadid, forumid, visible, open, pollid, title FROM " . TABLE_PREFIX . "thread WHERE forumid=$forum[forumid] AND visible IN (0,1,2) AND sticky != 1 AND lastpost <= " . (TIMENOW - ($forum['pruneafter'] * 86400)));
while ($thread = $vbulletin->db->fetch_array($threads))
{
delete_thread($thread['threadid'], false, true, NULL, false, $thread);
}
build_forum_counters($forum['forumid']);
}
log_cron_action('Forums pruned', $nextitem);
?>
- Create a new cronjob that runs autoprune.php whenever you want
That's all
Hi,
I'm just curious, how to specify the x days for each forum like the one in Forum Manager since the plugin has already been disabled or removed ?
Yes - over night (once a day) seems like a better idea than runing an intensive script like this each hour. How please? Thanks.
If you run in only once/day, the amount of threads to delete is higher, eg. the script runs longer.
That's the reason why it is (by default) executed every hour, as this keeps the amount small.
Quote:
wtf you lose your forum posts ammount
What else did you expect?
Pruned posts/threads are gone - forever.
Is this work fine in 3.6.8 ?, because I installed it and set it in a specific forum that I want to delete all the threads that are 30 days old or more, but nothing happened the old threads still there in that forum.
Or only works since now for the future threads that will be in that forum ?
Compatibilitty note vBulletin 3.7
As of vBulletin 3.7 Beta 4, the hook used for this Mod does not exist any longer.
After installting this Mod, please change the Hook location to cron_script_cleanup_hourly