View Full Version : Is there an auto - purge for PM's?
smirkley
09-07-2013, 05:59 AM
Basically it is like this. I have a bunch of members, many who have gone away and no longer visit.
In order to clean up the database, it occured to me that there are many old pm's in the inbox that could be dumped.
The definitions would be like this....
In Inbox only,
and any pm 30 days or older,
....Auto-delete.
I figure if anyone has a pm they want to keep, they should move it into a different folder in ther pm manager.
Otherwise it should be dumped after a pre-set amount of time.
I have searched but cannot find, is there a mod that does this?
DF031
09-07-2013, 06:01 AM
Why would you delete those PMs ?
smirkley
09-08-2013, 05:00 AM
Because I have almost 10 years of members, many whom have no longer returned,... and many whom have pms unread and otherwise,... that just fill up database space.
I would not mind setting policy that if given, would inform members that the last 30,45,60 days or whatever, if they have pms they want to keep, they should store in another folder in their acp.
I have identified several thousand pm's that are either unread or read, that just sit in thier pm inbox. And I want to make more effecient the database in that regard.
Look at it this way,... if they havent logged in in 90 days or much more,... it is time to purge the data to make the database take less space.
DF031
09-08-2013, 06:05 AM
I see. Still seems more more to prune than just leave it there. The last 15 years we changed / upgraded the forum software a few times and did not transfer the private messages. That was a good way to clean up things :-)
ozzy47
09-08-2013, 12:19 PM
There is this mod, https://vborg.vbsupport.ru/showthread.php?t=179879 which has been reported to work on vB4 if you use the xml in this post, https://vborg.vbsupport.ru/showpost.php?p=2067130&postcount=45 , after uploading the files from the OP's zip.
smirkley
09-13-2013, 04:45 PM
Thank you ozzy. I did do a search but only for v4, which is why I didnt find it. So serious thanks to you.
Question, I have installed and tested, works like a champ. But in the settings it says you can set for Inbox, Sent Items, or all others except Inbox/Sent Items.
I wish to change option 3 for BOTH Inbox/Sent Items and no other folders that a user may have custom.
The original code in prunepms.php:
case '3':
$pms_query_where_clouse .= " AND pm.folderid NOT IN (0, -1)";
break;
Would I change the code in prunepms.php to:
case '3':
$pms_query_where_clouse .= " AND pm.folderid = (0, -1)";
break;
or would this work instead:
case '3':
$pms_query_where_clouse .= " AND pm.folderid = '0'";
$pms_query_where_clouse .= " AND pm.folderid = '-1'";
break;
Obviously I have to be careful, but I am unsure of the syntax to make it work properly.
(I do know I will have to change the acp phrases)
I think you would want:
case '3':
$pms_query_where_clouse .= " AND pm.folderid IN (0, -1)";
break;
Maybe using = works the same as IN, I don't know, but you could just remove the NOT.
smirkley
09-13-2013, 05:05 PM
I had considered that too, thanks.
But if you select the first option, it runs this snippet:
case '1':
$pms_query_where_clouse .= " AND pm.folderid = '0'";
break;
Which is why I used an = and then the ( 0, -1) in my first suggested example.
This is definetly something I dont really want to screw up and end up deleting all pm's and having to perform a restore of my db lol.
snakes1100
09-13-2013, 06:17 PM
That hack doesnt work 100% regardless of changing the xml file, your going to end up with bad results on deleted PM records still showing up for users, which they cant get rid of.
Just a warning, always test old hacks that are reported to work on a test site.
smirkley
09-13-2013, 06:25 PM
That hack doesnt work 100% regardless of changing the xml file, your going to end up with bad results on deleted PM records still showing up for users, which they cant get rid of.
Just a warning, always test old hacks that are reported to work on a test site.
Thats the first I had read of that issue, it wasnt reported on the thread that I read.
In my prelim tests it appeared to have operated properly.
Can I ask did you try this mod and have this problem?
snakes1100
09-13-2013, 06:27 PM
Yes, i tested for a client, thats why i posted what i did & thats why it was rewrote because of that issue.
smirkley
09-13-2013, 06:44 PM
Is the rewrite in the latest download?
Or did you rewrite it for your client?
(and if so could you point me to the area to be rewritten?)
snakes1100
09-13-2013, 07:10 PM
No, sorry its a private script rewrite that wasnt released here.
Which is why I used an = and then the ( 0, -1) in my first suggested example.
I see. It's IN (1, 2, 3) to check for one of a number of values, but = just checks one.
I'm quite sure that you just want to remove the word NOT from the existing case 3. (But I don't know anything about the other issue you guys were discussing).
smirkley
09-13-2013, 07:28 PM
No, sorry its a private script rewrite that wasnt released here.
No biggie. I will keep an eye out whilst I test this. So far I have it working but if something crops up, I am sure I can figure it out.
I see. It's IN (1, 2, 3) to check for one of a number of values, but = just checks one.
I'm quite sure that you just want to remove the word NOT from the existing case 3. (But I don't know anything about the other issue you guys were discussing).
Thanks kh99. Since I can only test this on a daily basis (on a test usergroup, without bothering going into the database to backdate test pm's), I am going to test it (since I have already implemented it in test) by combining case 1 contents with case 2 contents into case 3 removing the old case 3 contents, and changing the phrase in the template for acp. This may not be the most effecient use, but I know the cron runs atm with this change without error. I will just have to wait till tomorrow to find out if it indeed operated as desired as I dont have enough time today to force the issue. If it doesnt work, I will try your suggestion and then report back. If it does, then eureka!!
Thanks again.
If you're talking about trying the last code you posted above, that won't work because the only way the condition would be true is if pm.folderid was equal to -1 and to 0. If you wanted to do it that way you'd need an OR (and add parens), like:
$pms_query_where_clouse .= " AND (pm.folderid = '0' OR pm.folderid = '-1')";
But that's actually equivalent to "AND pm.folderid IN (0, -1)", which is what you get by removing the NOT.
snakes1100
09-13-2013, 07:33 PM
Check the PM folders after it runs on its own for PM's that got deleted, but left the msg in the box, you will no longer be able to click or delete via the forum.
smirkley
09-15-2013, 02:35 PM
If you're talking about trying the last code you posted above, that won't work because the only way the condition would be true is if pm.folderid was equal to -1 and to 0. If you wanted to do it that way you'd need an OR (and add parens), like:
$pms_query_where_clouse .= " AND (pm.folderid = '0' OR pm.folderid = '-1')";
But that's actually equivalent to "AND pm.folderid IN (0, -1)", which is what you get by removing the NOT.
Forgot to return to this, but yes you are correct. My attempt didnt work as you suggested. Didnt prune anything in tests.
I will try your suggestion next and report back the results.
Is there a preferred methed? Use the OR or use the AND without the NOT?
Is there a preferred methed? Use the OR or use the AND without the NOT?
No, it's just two different ways of expressing the same condition.
smirkley
09-15-2013, 11:02 PM
If you're talking about trying the last code you posted above, that won't work because the only way the condition would be true is if pm.folderid was equal to -1 and to 0. If you wanted to do it that way you'd need an OR (and add parens), like:
$pms_query_where_clouse .= " AND (pm.folderid = '0' OR pm.folderid = '-1')";
But that's actually equivalent to "AND pm.folderid IN (0, -1)", which is what you get by removing the NOT.
That did the trick on a manual run of the cron. I will be testing it on auto cron tonight, but it looks like it worked perfect.
Thank you once again kh99
(I will likely post these changes on the original 3.7 thread)
(if it says reusable code, does that mean I can submit this in my name with original credits as a new 4.x mod?)
smirkley
09-17-2013, 03:42 AM
Thank you all.
I checked tonight to verify a natural automatic cron prune of stale pm's on a test account in a test usergroup.
Previously I verified it works as desired with a manual run of the cron, but I wanted additional verification on auto-cron plus to check for any other anomoloies.
I logged in and noticed it hadnt worked. I logged in my acp and looked at my cron que and noticed a few of them had stacked up due to lack of traffic. So I clicked my forum a few times and rechecked the cron. Caught up and done according to logs. Then I logged in my test account, and low and behold, it worked and worked perfectly in both inbox and sent folders, leaving custom folders untouched.
Now, as far as this problem suggested,..
That hack doesnt work 100% regardless of changing the xml file, your going to end up with bad results on deleted PM records still showing up for users, which they cant get rid of.
I have no idea what this is referring to as two test user accounts, two different usergroups, and three manual cron tests and two auto cron tests,... and I have not experienced this at all.
In fact, it works perfectly.
THANK YOU all that helped !!
CAG CheechDogg
05-15-2014, 12:52 PM
Thank you all.
I checked tonight to verify a natural automatic cron prune of stale pm's on a test account in a test usergroup.
Previously I verified it works as desired with a manual run of the cron, but I wanted additional verification on auto-cron plus to check for any other anomoloies.
I logged in and noticed it hadnt worked. I logged in my acp and looked at my cron que and noticed a few of them had stacked up due to lack of traffic. So I clicked my forum a few times and rechecked the cron. Caught up and done according to logs. Then I logged in my test account, and low and behold, it worked and worked perfectly in both inbox and sent folders, leaving custom folders untouched.
Now, as far as this problem suggested,..
I have no idea what this is referring to as two test user accounts, two different usergroups, and three manual cron tests and two auto cron tests,... and I have not experienced this at all.
In fact, it works perfectly.
THANK YOU all that helped !!
Hello smirkley, I am trying to add this to my forums and I would like to know what was the final changes you did to the prunepms.php file to get this working like you wanted it to. Can you please share it my Man?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.