MyBB Community Forums

Full Version: AutoExpunge 1.0 WARNING
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
To users of AutoExpunge 1.0 :

this plugin leaves garbage in the forum tables.

It remove only records from 'threads' table, but leave all related posts, attachments, polls, poll votes, subscriptions, etc.

for example, number of garbage posts
SELECT count( * )
FROM mybb_posts p
WHERE p.tid NOT
IN (
SELECT t.tid
FROM mybb_threads t
)

you are correct i just checked the task file and it only deletes from the threads table and leaves the posts table alone. i've got 71,000+ posts left over from that query you posted...
I have 89,000+ Sad
edit the \inc\tasks\autoexpunge.php file and

replace

$db->delete_query('threads', "fid = '{$mytask['fid']}' and (" . TIME_NOW . " - " . ($mytask['lastpost'] == 1 ? "lastpost" : "dateline") . ") > $age");

with

$query = $db->simple_select('threads', 'tid', "fid = '{$mytask['fid']}' and (" . TIME_NOW . " - " . ($mytask['lastpost'] == 1 ? "lastpost" : "dateline") . ") > $age");
while($result = $db_>fetch_array($query))
{
	delete_thread($result['tid']);
}

this wont fix the existing problems, but it wont create anymore.....
that's clear, thanks !

but I'll still investigate how to clean up, one problem disturb me: (number of garbage posts from query above) + (number of posts displayed on forum index) > (number of records in _posts table).
i am building a small script to clean 500 posts at a time using the built in mybb functions. deleting polls first and then posts (which handles attachments)

my site has about 1000 more posts in the posts table than what the index-query shows.
(2010-08-25, 09:15 PM)pavemen Wrote: [ -> ]i am building a small script to clean 500 posts at a time using the built in mybb functions. deleting polls first and then posts (which handles attachments)

share it please Wink

for your modification of AutoExpunge task I suggest to add condition to not remove sticky threads

$query = $db->simple_select('threads', 'tid', "fid = '{$mytask['fid']}' and sticky = 0 and (" . TIME_NOW . " - " . ($mytask['lastpost'] == 1 ? "lastpost" : "dateline") . ") > $age");
while($result = $db_>fetch_array($query))
{
    delete_thread($result['tid']);
} 

the sticky check is a good suggestion. i will add that to my copy.

i am testing the cleaner now, at 500 posts at a time, it will be while to finish 71,000....
so far the script appears to be working. its a little slow but it works. it is currently set to run 1000 posts at a time so you may want to change the $limit variable on yours before running. i am on a fairly decent dedicated server so you responsiveness may be different than mine.

just upload to the mybb root folder

it is a manual process, clicking 'next set' after each run.
ifyou have undo delete plugin activated, you should disable it first, otherwise it will be even slower. i made a backup of the posts, polls, attachments tables before starting
thanks, I'll take a close look on it tomorrow - it's 2am in my timezone Wink
thanks again.

I modify it by adding

- cleaning of redirects
- cleaning of threadratings, threadsubscriptions, threadsread
- progress show (waiting without it killing me Smile ).

[attachment=19588]

and don't forget to recount counters.
thanks for share.
this what I am looking for Wink

Pages: 1 2