PDA

View Full Version : Cron Job Script to Delete Redirect Threads


LancerForums
11-21-2002, 06:36 PM
Hi,

I'd like to write a script that will run everynight and delete x old threads that are redirects.

I want to make sure that I get this right, since I don't know exactly how the moved w/ redirect feature works, though.

Would this script do the job correctly without deleting the real thread?

//
// Delete all redirects that are older then $numdays
//
$numdays=3;
$datecut=time()-($numdays*86400);
mysql_query("DELETE FROM thread WHERE open='10' AND lastpost<=$datecut");

Thanks,

Mark

Logician
11-22-2002, 09:12 AM
yes Mark, your code looks correct. But you may want to test it for a while in your test board if you like.

Btw. I'm sure you know you need to add MYSQL_connect command and choose db beforehand.

LancerForums
11-22-2002, 01:04 PM
ok, I'll try testing it on my test forum for a little while before using it on the real forums.

Thanks,

Mark