View Full Version : Administrative and Maintenance Tools - Auto Purge Threads
Seductor
12-09-2011, 11:00 PM
What does this hack do ?
This tool is based on Auto Delete/Move tool by HaMaDa4eVeR for vBulletin 3.6.4.
This hack can delete the threads that was created before X days in your specific forums or it can move threads to specific(Archive) through scheduled task.
Features:
Turn On the plugin
Turn On/Off Move system.
Turn On/Off Delete system.
Specific forums for move and delete.
Specific "Archive Forum".
Protected Users.
Delete Type (soft/hard).
Automatically update counters.
Choose to delete/move stickies.
Set how old must a thread be.
NO Code Modifications needed!
Installation:
1. Unzip the download package and copy the contents of the folder UPLOAD to your forum root
2. Go to the VB AdminCP->Plugins & Products click "Manage Products". Then click
"Add/Import Product" at the bottom of the page.
3. Click "Browse" button and point to the installation XML file included in this ZIP package.
4. Click "Import"
5. Once the gallery import is complete, you can setup your Auto Purge. Go to VB AdminCP -> Options -> Auto Purge Threads to setup the Auto Purge.
Also, you can change the cron setup in the task manager.
NOTE:
The default settings are:
- Soft delete for the threads that have been created before 15 days ago.
- Protected user that have id 1 & 2.
- It will running everyday at 5.00 AM.
Updates:
-------
v1.00
It is now vBulletin 4.x.x compatible.
Cron task added successfully. Removed some old SQL queries.
Removed the zero replies thread search.
Spanish translation added.
v1.01
You can set if you want to remove stickies.
If you move your threads, you can set if you want to unstick them if they are sticky.
XML tidied.
v1.02
You can set if you want to manually update your forum counters.
PHP tidied and optimized.
v1.03
Now you can move and/or delete different forums.
v1.03b
Fixed a MYSQL error.
v1.03c
Fixed a bug related to Protected users.
v1.04
Fixed a bug (thanks gocreate).
You can set if you want to remove locked threads.
You can set if you want to remove only threads without replies that match your other conditions.
v1.04b
Now you can protect some threads from moving/deletion.
v1.04d
Some bugs fixed.
v1.05
You can send PM when AutoPurge finish its work.
Next updates:
(sighs)
Special thanks to BirdOPrey5 :D
Any donation?https://vborg.vbsupport.ru/external/2011/12/12.gif
I'm not begging but If you want, I would be glad to receive a small donation. There are 4.4 million unemployed in my country and It is hard to be employed.
karlm
12-11-2011, 12:12 AM
looks good... will look into it shortly :)
mitch84
12-11-2011, 07:13 AM
nice idea!
Seductor
12-11-2011, 02:21 PM
Any suggestion?
THX_Ultra
01-01-2012, 07:59 PM
Great! This is EXACTLY what I was searching for - a cron job that automatically moves threads from one subforum to another after a certain period of time! ;)
kingMOB
01-01-2012, 10:06 PM
Nice idea =)
Could be an option to mark threads to be auto purged? So after some days from the creation date the thread would be moved to another forum?
OldSchoolDSL
01-01-2012, 11:33 PM
Wonderful.
I have a forum that is dedicated for "post testing". So as you can expect it fills with junk. This will be a good way to clear this out.
Seductor
01-02-2012, 11:41 AM
Nice idea =)
Could be an option to mark threads to be auto purged? So after some days from the creation date the thread would be moved to another forum?
Do you mean to mark them manually? I do not think it could be possible at the moment. It would require to add a lot of code, but I'll keep it in mind.
OldSchoolDSL
01-02-2012, 05:25 PM
Wonderful.
I have a forum that is dedicated for "post testing". So as you can expect it fills with junk. This will be a good way to clear this out.
Working in 4.1.10 Alpha 2
Request: In a future version, can you please have it so I can ID more than 1 forum with more than 1 function?
That is to say, I'd like this to delete everything in forum "X" (the forum people use to test post), but move other post from from Y,W,Z into an archive forum.
As it stands now, I can only do one or the other and not both.
Seductor
01-05-2012, 12:54 PM
@OldSchoolDSL, I think you are able to do it now. Please, If you find any bug, report it and I'll fix it.
@Seductor (autonote): Remove only threads without replies.
1.0.3b released: I have fixed a MYSQL error. Sorry guys, it was a silly mistake.
THX_Ultra
01-08-2012, 09:36 AM
Hi, I don't know why, but it seems that the Plugin does not work anymore since the 1.03b update.
Just for my understanding - If I want to move threads after 3 days from one forum to another.
I enter at "Thread must have been created earlier than X days." the number 3 - right?
So everything worked fine until I updated to 1.03b - now It doesn't move threads anymore, even If i start the cron job manually.
Do I have to completely uninstall the addon before updating, or is there anything I missed?
I'd appreciate your help, because the addon would be extremely helpful for me.
Seductor
01-09-2012, 05:16 PM
It seems to be broken. However, it works If I run it manually.
The cron path seems to be right. The scheduled hour seems to be okay too.
@THX_Ultra could you help me? Go to Scheduled Tasks > Scheduled Task Log and check if there is any Auto Purge Threads action. I have one everyday at 5 AM. Do you have any?
Btw, I have edited the AutoPurge options, perhaps you should recheck them. Do you have Enable Plugin set to "yes" and Move threads and/or Delete threads to "yes" too?
@Trangalleiro: I have received your PM, however you have set you don't want to receive PMs. I can't answer you through private messaging.
OldSchoolDSL
01-09-2012, 05:52 PM
This is the error I got on every version of this modification. The error happen only when I enabled this.
Invalid SQL:
SELECT * from `thread`
Where forumid IN(2)
AND `postuserid` NOT IN ()
AND `dateline` <= '1323405149';
MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
AND `dateline` <= '1323405149'' at line 3
Disabling this resolved the issue.
THX_Ultra
01-09-2012, 06:42 PM
@THX_Ultra could you help me? Go to Scheduled Tasks > Scheduled Task Log and check if there is any Auto Purge Threads action. I have one everyday at 5 AM. Do you have any?
Yes it is, but i switched back to 1.0.2 and everything works fine now. It was also working with 1.0.3 but since switching to the 1.0.3b it didn't...
One more thing - I realised that the field for protected users have to be filled with something, but for moving threads, I do not want to have any user protected. Can I enter 0 instead of eg. 1 or any other userid?
Does this affect the addon?
Seductor
01-09-2012, 06:43 PM
Oh, @OldSchoolDSL, It is an easy error. I have never tought that Protected Users could be void. I will fix it but, meanwhile, have you seen any other bug?
Yes it is, but i switched back to 4.0.2 and everything works fine now. It was also working with 4.0.3 but since switching to the 4.0.3b it didn't...
1.03 worked? That is odd, 1.03b only fixes a SQL sentence, but it is almost the same as 1.03. As OldSchoolDSL pointed, have you got Protected users void?
OldSchoolDSL
01-09-2012, 06:56 PM
Oh, @OldSchoolDSL, It is an easy error. I have never tought that Protected Users could be void. I will fix it but, meanwhile, have you seen any other bug?
1.03 worked? That is odd, 1.03b only fixes a SQL sentence, but it is almost the same as 1.03. As OldSchoolDSL pointed, have you got Protected users void?
That's the thing. I didn't have any protected users. Wanted this mod to apply to all.
Because of the error, nothing ever happen... ie... The modification to my knowledge didn't work. I never did see the error on my screen, only got the e-mails about it.
THX_Ultra
01-09-2012, 07:02 PM
Yes 1.03 worked fine - when I use 1.03b and leave everything unchanged - it doesnt. If i start it manually it just does not move threads.
I have one protected user, but i just use it because I get an error messag if I leave it blank.
Seductor
01-09-2012, 10:28 PM
Now (1.03c) you can void Protected users.
I have changed the SQL sentences and now it is easier to edit the them. Now it works like:
$query = "SELECT * from `" . TABLE_PREFIX . "thread` Where forumid IN($frommove) AND `dateline` <= '" . (TIMENOW - ($whencreated * 86400)) . "'";
if(!$deletesticky)
{
$query .= " AND NOT `sticky`";
}
if(!empty($idadmin))
{
$query .= " AND `postuserid` NOT IN (".$idadmin.")";
}
If you have not protected users, empty($idadmin) will be true and then the condition AND `postuserid` NOT IN ( ) will not be added. You will not have the SQL error because of it.
It seems to work for me. I have not Protected users and I don't want to move stickies. I have enabled the debug mode and it shows this:
https://vborg.vbsupport.ru/external/2012/01/57.png
So it seems to work perfectly.
FYI: 1.04 will have "Protected threads". I'm working on it.
micro image
01-31-2012, 07:32 PM
Installing this, will report soon. GREAT mod, thank you!
spillage
02-01-2012, 01:34 AM
Option request; Last post X days as move/delete criteria.
GrabMyWrist
02-01-2012, 04:06 PM
Option request; Move locked threads to specified forum or delete.
Fuzzy Orange
02-19-2012, 09:24 AM
Option request; Last post X days as move/delete criteria.
I'd love this as well - it's nice to be able to delete all my for sale threads after 90 days, but it would be nicer to delete them when they've not had a reply in 30 days :)
Seductor
02-19-2012, 11:45 AM
I was trying to rebuil all the whole system, but taking in cout the many request you are writing, perhaps I should focus on them.
ludachris
03-13-2012, 07:11 PM
Any chance this mod would work in 3.8.x?
Seductor
03-13-2012, 08:07 PM
Any chance this mod would work in 3.8.x?
I think it could work properly in 3.8.X, but I didn't test it.
copjend
03-17-2012, 06:52 AM
I tried to install in my vBulletin 4.1.7 Patch Level 2, but is not working
Seductor
03-17-2012, 12:21 PM
I tried to install in my vBulletin 4.1.7 Patch Level 2, but is not working
Did you get any error?
gocreate
04-10-2012, 07:43 AM
There is a small error in script:
$fromdelete = $vbulletin->options['forudelete'];
Schould be:
$fromdelete = $vbulletin->options['forumdelete'];
Seductor
04-10-2012, 08:52 AM
Thanks gocreate! I'm going to fix it.
Seductor
04-10-2012, 09:48 AM
I've add some features and I've fixed the forumdelete bug. Thanks again, gocreate.
NOTE: Please, don't upgrade it yet, I've found some small bugs. I'm going to fix them when I'm back at home
Trangalleiro
04-10-2012, 10:31 AM
Thanks Seductor
Seductor
04-10-2012, 02:20 PM
Fixed and added a new feature.
/me waves at Trangalleiro
sweetpotato
04-16-2012, 06:18 AM
Installed and waiting to see it working. Can you add an option to move moderated thread also?
Thanks,
Seductor
04-16-2012, 02:44 PM
Installed and waiting to see it working. Can you add an option to move moderated thread also?
Thanks,
Sure I will add it in the next release.
Hostboard
04-30-2012, 11:17 PM
Request: Some sort of log file to show from, to and how many threads were moved/deleted and make it searchable say by date via the ACP. OR even simpler a PM or email notification at the least.
Seductor
05-01-2012, 07:43 AM
Request: Some sort of log file to show from, to and how many threads were moved/deleted and make it searchable say by date via the ACP. OR even simpler a PM or email notification at the least.
It is a good idea. Meanwhile, you can use the debug mode set in the php file.
sweetpotato
05-08-2012, 01:32 AM
It seems not work on my site. Do I have more config please?
Error:
Database error in vBulletin 4.1.12:
Invalid SQL:
SELECT * from `thread` Where forumid IN(34,39,43) AND `dateline` <= '1333852516' AND NOT `sticky` AND `replycount` = 0 AND `postuserid` NOT IN (1,82,4461,7269) AND `threadid` NOT IN ();
MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
Error Number : 1064
Request Date : Monday, May 7th 2012 @ 07:35:16 PM
Error Date : Monday, May 7th 2012 @ 07:35:18 PM
Script : cronadmin.php?do=runcron&cronid=214
Referrer : /cronadmin.php?do=modify
Classname : vB_Database
MySQL Version : 5.0.92-log
Seductor
05-14-2012, 09:26 AM
It seems not work on my site. Do I have more config please?
Error:
Sweetpotato, update your plugin to the latest version, I have done some fixes.
sweetpotato
05-14-2012, 03:05 PM
Just updated, run the task and see no error. I would be nice if you could add protected user groups.
Thanks,
Easy5s.net
05-18-2012, 02:55 AM
I'm using with this mod
https://vborg.vbsupport.ru/showthread.php?t=116605
and I want after the user buys the theme topics are moved to their previous position.
Seductor
05-18-2012, 12:18 PM
@Easy5s.net Send me a pm.
thunderclap82
05-24-2012, 01:37 PM
Any plans to implement the requested feature of pruning from the last reply instead of original post? I, too, would love this feature.
Seductor
05-31-2012, 08:54 AM
Any plans to implement the requested feature of pruning from the last reply instead of original post? I, too, would love this feature.
But... what would it need to check from the last reply?
Seductor
06-04-2012, 09:12 PM
The new PM notifier is a sh...t :\ It sends a lot of PMs, does not work as I expected.
nodofollow
07-25-2012, 06:59 PM
is it possible to make thread to closed not purged ?
bzcomputers
09-23-2012, 01:42 PM
Any plans to implement the requested feature of pruning from the last reply instead of original post? I, too, would love this feature.
Could definitely use this mod also if it added the option to go form the date of the last post in thread instead of original thread posting date.
bzcomputers
10-17-2012, 08:04 AM
I get this error when running cron job manually:
Fatal error: Call to a member function query_read_slave() on a non-object in /home/XXXXXX/public_html/forum/includes/functions.php on line 8503
functions.php: lines 8503-8598
$data = $db->query_read_slave("
SELECT *
FROM " . TABLE_PREFIX . "navigation
WHERE state & " . NAV_DELETED . " = 0
ORDER BY navtype, displayorder
");
Edit:
If I turn off "Enable PM's" this error does not show.
bzcomputers
10-18-2012, 04:05 AM
There also seems to be in error in updating counters for the archive forum also.
I had to edit cronautopurge.php:
$threadman->save();
//Update forum counters
if($buildcounters)
{
build_forum_counters($thread['forumid']);
build_forum_counters($to);
}
echo "Auto Move Threads:<i>".$thread[title]."</a></i><br>";
log_cron_action('Threads moved.', $nextitem);
If I change "$to" above to the actual forum id of the archive forum it works but it will not work using the archive forum input in the admin settings.
Example: If you set "20" in admin settings for archive forum it does not update, if you set "20" directly in the cronautopurge.php "build_forum_counters(20);" it works.
Shazz
11-06-2012, 02:29 AM
The only option I'm using is to move threads from one forum to the other.
I need the threads moved every night at midnight, I know there is code for a scheduled task for this as well.
If anyone can assist I will definitely make it worth your wild.
ndahiya
01-01-2013, 09:04 PM
Hi Seductor,
Are you planning to release an update to this with the bugs fixed? Would appreciate it.
I am looking to set up a craigslist style classifieds forum, and think i can comine this with a "forms" plugin to achieve the result.
One other extension suggestion (good to have) is to have a per thread (user selected) ad expire duration, and use that to check in the cron job rather than the standard expire duration.
TIA
ndahiya
Markco
01-02-2013, 01:28 PM
I am using version vb4.20pl3 and 1.5 plug-in do not work automatically, work manually, no error message.
Barbara1
01-17-2013, 10:38 AM
4.2.0 PL3 (test forum- closed to public and almost duplicate of the live forum). i have edited the settings the way i wanted them, i pressed the "run now" from task manager, but instantly i got the message "Done" and nothing happened.
i think i am missing something. any ideas? :)
edit: at the task manager everything about the hack's settings is with an asterisk. dunno if this has to do with the "run now" option
Big-Pete
01-30-2013, 02:22 PM
Anychance of this being updated to work with vB4.2 ??
Markco
01-31-2013, 07:53 AM
I am using version vb4.20pl3 and 1.5 plug-in do not work automatically, work manually, no error message.The cron works fine but not of log in Control Panel Log Viewer while Log Entries is yes !!!
vicius_the_one
02-27-2013, 07:09 PM
Anyone can make me understand please ? : is it working to move/delete threads after x days of inactivity ? That is all I want :)
Klangfuzzi
03-11-2013, 08:16 AM
May I suggest an additional feature?
To make this mod perfect fitting for my forum, it would need the option:
"Move threads with no activity for x days"
Means. No Post since x days
fxdigi-cash
05-14-2013, 12:43 PM
I see many questions and issues above... does that imply that the mod doesn't work??
did anyone test it on vb4.2??
I will try that as well if I finish my updates...
maisev
06-11-2013, 04:20 AM
I see many questions and issues above... does that imply that the mod doesn't work??
did anyone test it on vb4.2??
I will try that as well if I finish my updates...
It is working on vb 4.2.1
adwade
07-06-2013, 01:01 AM
I think it could work properly in 3.8.X, but I didn't test it.
Two quick questions:
1)Has anyone tried this version with vB 3.8.x
2)Rather than the Protected Users feature, would it be possible to tweak a line or two of code and change it to function against only Targeted Users?
Allow me to explain...
We have a NewBot that automatically posts stories (via an RSS feed) and I am hunting for a way to automatically delete old stories off the board.(i.e. say after they're 1yr old) So rather than Protecting certain users, I would like to be able to run this MOD and have it ONLY function against our NewsBot's threads.
Seductor
07-06-2013, 04:55 PM
Sorry guys, it should be working for 4.2.1. I'll try to improve this plugin soon :)
ShatteredMobius
09-07-2013, 12:53 AM
Request: Have the option for it to purge/move based on post count limit?
Say if the post count is greater or equal to a set limit when the scheduled job is ran.
asabet
11-04-2013, 12:28 AM
Request: Option to only move closed threads
Maxii
03-30-2014, 02:23 PM
how to move with multiple forums
as i have to move Effected Forums (multiple) & Archieve forum (Multiple) after every 30 days
example from forumid 1 to 2 after 30 days
forumid 3 to 4 after 30 days
forumid 8 to 9 after 30days
dariyos
06-12-2014, 12:09 PM
doesnt work on vb 4.2.2 PL 1 ...
bugfix/update?
kylek
06-26-2014, 06:24 AM
Just found this and installed, runs fine on 4.2.2 PL 1. We needed this as we have several forums that have rss feeds like horoscopes and it was a pain to go in and manually delete them after a time.
oldengine
10-21-2014, 01:27 PM
The following dependencies were not met:
This product is not compatible with version 3.8.9 Beta 2 of vBulletin. (Compatible starting with 4.0)
ozzy47
10-21-2014, 07:37 PM
Well yeah, as the mod is in the vB4 mod section, it would only stand to reason it is for vB4 not vB3. :)
BirdOPrey5
10-23-2014, 11:08 AM
The following dependencies were not met:
This product is not compatible with version 3.8.9 Beta 2 of vBulletin. (Compatible starting with 4.0)
I guess that answers my question. :down:
Not really. If you're willing to test it edit the xml file in a code editor and change the min version. This looks like it would work in 3.8. The min version is set in the first few lines of the file. Look for 4.0.0 and change it to 3.0.0, resave, and retry importing the file.
Well yeah, as the mod is in the vB4 mod section, it would only stand to reason it is for vB4 not vB3. :)
Ordinarily I'd agree, and he certainly shouldn't expect support from the author who probably could only test it on 4.x, but as this mod is just a scheduled task I'd strongly suspect it works fine on 3.8.
oldengine
10-23-2014, 04:32 PM
OK, it's in, thanks!
Everything is functional with no errors on 3.8.9 Beta 2.
I do need to fine tune the settings and figure out why it repeatedly ran for the first time, or at least it flooded my PM in-box. Like I said, fine tuning and sifting through the posts here.
dknelson
11-19-2014, 10:04 AM
Great mod and I am using it but the fact that all forums must use the same criteria is a big negative. There was a similar mod that I used on my 3.8 board that allowed you to set different days to prune for different forums. I have a couple of forums that I would love to auto prune but one is pruned every 7 days and the other I want to prune every 90 days.
ageurtse
12-20-2014, 05:15 PM
Is it possible to purge only inactive threads ?
if so what do i have to alter.
i know i have to look at last post but how do i do that.
TAIFUN_T
11-11-2019, 09:59 AM
I recommend changing time setting for the cron.
Find:
<scheduling weekday="-1" day="-1" hour="5" minute="-1" />
Replace with:
<scheduling weekday="-1" day="-1" hour="5" minute="10" />
dknelson
11-11-2019, 10:18 AM
I recommend changing time setting for the cron.
Find:
<scheduling weekday="-1" day="-1" hour="5" minute="-1" />
Replace with:
<scheduling weekday="-1" day="-1" hour="5" minute="10" />
May I ask why?
TAIFUN_T
11-11-2019, 10:43 AM
May I ask why?
Because the task
<scheduling weekday="-1" day="-1" hour="5" minute="-1" />
will be performed every minute for one hour (start 05:00 AM). It does not make sense.
dknelson
11-11-2019, 11:08 AM
OK.....thanks.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.