PDA

View Full Version : Cronjob: remove redirects after X days


Boothby
03-06-2005, 03:59 PM
I'm looking for a cronjob, which removes redirects to moved threads after X days. I hope you can help me.

Thx.

sabret00the
03-06-2005, 04:04 PM
isn't this a default vB action?

Paul M
03-06-2005, 04:15 PM
It's not a default part of vB.

Personally I just put this in the includes/cron/cleanup2.php, at the top, before the "delete stale sessions" code.


// Auto delete re-directs.
$DB_site->query("
DELETE FROM " . TABLE_PREFIX . "thread
WHERE open = 10 AND dateline < ". intval(TIMENOW - (60 * 60 * 24 *5))
);

It removes them after 5 days.

memobug
03-06-2005, 06:21 PM
This would be a nice feature.

Regards,

Matt

Boothby
03-06-2005, 06:28 PM
Thank you Paul. :)

Boothby
04-21-2005, 04:38 PM
Now I need 2 more cronjobs.

First, one which deletes "Deleted Posts / Threads" finally.

Secondly I would like to set a profile field, in which users can insert a number of days, after which their PMs are deleted. And the cronjob I am looking for should do the delete.

Stargesicht
10-08-2005, 10:50 AM
wrong Post from me!!!
Sorry..

Boothby
10-08-2005, 06:06 PM
And I hoped that someone could help me with my last post I did in April. :(

makaiguy
07-26-2006, 12:06 AM
Just discovered this.

It's not a default part of vB.

Personally I just put this in the includes/cron/cleanup2.php, at the top, before the "delete stale sessions" code.


// Auto delete re-directs.
$DB_site->query("
DELETE FROM " . TABLE_PREFIX . "thread
WHERE open = 10 AND dateline < ". intval(TIMENOW - (60 * 60 * 24 *5))
);
It removes them after 5 days.
For vB 3.5, it's:

$vbulletin->db->query_write("
DELETE FROM " . TABLE_PREFIX . "thread
WHERE open = 10 AND dateline < ". intval(TIMENOW - (60 * 60 * 24 * 5))

Thanks, Paul. Very handy. *installs*