vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Auto Prune Threads (https://vborg.vbsupport.ru/showthread.php?t=99881)

Quarterbore 08-29-2006 07:55 PM

Does this physically remove the old threads from the database? Does the line of code that says "delete_thread($thread['threadid'], false, true, NULL, false, $thread);" use the built in vBulletin functions to remove the thread and posts?

Can someone help me find the "delete_thread" function?

Please confirm just what this script does...

Thanks!

EDIT:

OK, I think I figured out what this calls but it will take me some time to figure the code out.. I assume this is using the class_dm_threadpost.php file to handle the removal of the thread and that it will also remove the posts and that these removals are by removal or the rows of data from the database...

:alien:

adusei 09-14-2006 03:32 PM

Hi,

tried this hack - and nothing happened :confused:
Ok, read the small text in the forum manager again, and it says:

"will automatically prune all Threads from this Forum where the last reply is older then the set amount of days"

A-HA! So, if I have threads WITHOUT any replies they won't be deleted. Is that right?
How can the code be changed to enable the pruning of threads without replies older than x days??? Possible?

TIA and best regards,

adusei

coffee 11-17-2006 10:10 PM

Adusie,

Open the xml file and Edit line #27, by replacing where it says: "lastpost" with "dateline".

Then import the product with: "Allow Overwrite" option enabled.

btw, Working perfect in 3.6.3

TsirhCitna 12-25-2006 02:12 PM

Does this work on sub-forums too?

As in will the setting it to prune on the parent effect the child forums too?

telc 01-27-2007 01:23 AM

Does anyone know the function to move a thread? I rather have it move all the threads to a dedicated forum, then I can manually prune that single forum when my server is offline, since pruning is extremly CPU intensive when pruning thousands of threads.

I would like to change this:

PHP Code:

delete_thread($thread['threadid'], falsetrueNULLfalse$thread); 


To move the thread to a dedicated forumID, that I use as a recycle bin.

Sir_Yaro 04-09-2007 06:19 PM

works for 3.6.5:D

xrayeramy 04-10-2007 05:24 AM

Anyone willing to hold a n00bs hand? I would love to use this to delete all threads in one forum at midnight each night. I need explicit instructions though, not just a bunch of code. Tell me where to put it, copy this, paste here, change this....and I can fly with it. But just giving me code...I'm lost.

MikeWarner 04-11-2007 11:51 AM

Yes - over night (once a day) seems like a better idea than runing an intensive script like this each hour. How please? Thanks.

unnpro 05-07-2007 08:03 AM

Quote:

Originally Posted by MikeWarner (Post 1224898)
Yes - over night (once a day) seems like a better idea than runing an intensive script like this each hour. How please? Thanks.

- Disable or remove "Auto-Prune Threads" plugin in the plugin section
- Upload in your cron dir (includes/cron/) a php file (e.g. autoprune.php) with this code:
Code:

<?php
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
    exit;
}

require_once(DIR . '/includes/functions_databuild.php');
$forums = $vbulletin->db->query_read("SELECT forumid, pruneafter FROM " . TABLE_PREFIX . "forum WHERE pruneafter > 0");
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 != 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']);
}

log_cron_action('Forums pruned', $nextitem);

?>

- Create a new cronjob that runs autoprune.php whenever you want

That's all :)

DieselMinded 07-06-2007 01:51 PM

Is there a better version for this? 3.6.7 ?


All times are GMT. The time now is 07:28 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01103 seconds
  • Memory Usage 1,742KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete