PDA

View Full Version : Mass Prune Threads By Last VIEWED Date


ryand789
12-11-2002, 03:12 PM
Hello,

I was just starting to do some mass pruning, but had some concerns. (My database is up to 2.6 GIGS.)

I was deleting some threads, but noticed that there were some GOOD threads being deleted! They were old, but had some really good information on bodybuilding and nutrition. I believe these posts are a good resource for future users and I would love to leave them there for when people search on certain subjects...

So there may not have been any new POSTS in a thread for over 6 months, but there may have been a lot of people VIEWING the posts and getting the information from them.

Is there a way to delete threads where they have not been VIEWED for over X days?

What about a way to delete threads where that are over X days old that have had ZERO replies? There a lot of useless threads like that which can be deleted real quick. You know the kind of thread...

On a side note, I am deleted posts mainly because our search is starting to SLOW down. How much more would it slow down if I change it from 4 letter minimum to 3 letter minimum? There a lot of product and workout names that are three letters only and it really makes it tough to search for them... (like ZMA, HIT, SAN...)

Thanks a ton for your help! I hope there is a way to do what I asked above and if not, hopefully there will be in the near future.

PARTY ON!

Ryan DeLuca
Bodybuilding.com

Xenon
12-11-2002, 03:29 PM
no, it is not possible to delete thread that have not been viewed since x days, because the date of last viewing is not saved into the table...

it would require hacking of showthread.php and changes to the db...
also it would just work with new threads. threads which are not viewed till your next pruning day would become deleted, because the lastview date is too old...

question two: that would be possible, with not to much work:
open thread.php
find
doformheader("thread","prunedate");
maketableheader("Prune by date");
makeinputcode("Delete threads with last post older than x days:<BR>(intensive if deleting a lot of threads)","daysdelete","");
makemodchoosercode(-1,-1,'','All forums','In forum',0);

doformfooter();

change it to
doformheader("thread","prunedate");
maketableheader("Prune by date");
makeinputcode("Delete threads with last post older than x days:<BR>(intensive if deleting a lot of threads)","daysdelete","");
makeyesnocode("Delete just unanswered threads?","justempty",0);
makemodchoosercode(-1,-1,'','All forums','In forum',0);

doformfooter();

then find:

$datecut=time()-($daysdelete*86400);
$threads=$DB_site->query("SELECT threadid FROM thread WHERE $forumcheck thread.lastpost<=$datecut");
while ($thread=$DB_site->fetch_array($threads)) {
deletethread($thread[threadid],0);
}

and change it to:

$datecut=time()-($daysdelete*86400);
$threads=$DB_site->query("SELECT threadid FROM thread WHERE $forumcheck thread.lastpost<=$datecut".iif($justempty," AND replycount=0",""));
while ($thread=$DB_site->fetch_array($threads)) {
deletethread($thread[threadid],0);
}

that should work :)