The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
What would the SQL query be for delete all threads older than 90 days from an array of forums?
I want to write a simple php file I can use with the "Scheduled Task" option on the vB adminCP to auto-prune the forums I use for classifieds. Thanks |
|
#2
|
||||
|
||||
|
Maybe use an existing hack: Auto Prune Threads
If you don't want to use that one, you can at least download it and see what the query is. |
|
#3
|
|||
|
|||
|
Quote:
|
|
#4
|
|||
|
|||
|
The original code is :
Code:
while ($forum = $vbulletin->db->fetch_array($forums))
{
$threads = $vbulletin->db->query_read("SELECT threadid, forumid, visible, open, pollid, title FROM " . TABLE_PREFIX . "thread WHERE forumid=$forum[forumid] AND visible IN (0,1,2) AND sticky IN (0,1) AND lastpost <= " . (TIMENOW - ($forum['pruneafter'] * 86400)));
while ($thread = $vbulletin->db->fetch_array($threads))
{
delete_thread($thread['threadid'], false, true, NULL, false, $thread);
}
build_forum_counters($forum['forumid']);
}
Code:
while ($forum = $vbulletin->db->[7,8,9])
{
$threads = $vbulletin->db->query_read("SELECT threadid, forumid, visible, open, pollid, title FROM " . TABLE_PREFIX . "thread WHERE forumid=$forum[forumid] AND visible IN (0,1,2) AND sticky IN (0,1) AND lastpost <= " . (TIMENOW - (90* 86400)));
while ($thread = $vbulletin->db->fetch_array($threads))
{
delete_thread($thread['threadid'], false, true, NULL, false, $thread);
}
build_forum_counters($forum['forumid']);
}
|
|
#5
|
||||
|
||||
|
No, that is not going to work. You should ask for help in the modification thread. They know the code and are best able to help you.
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|