Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-13-2004, 08:47 PM
Indy Indy is offline
 
Join Date: Jun 2002
Location: Indianapolis, IN
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default vBCron and Pruning

From what I was reading at vB, vB3 almost had this.

I would like to have vBCron prune threads older than xx days in selectable forums/catagories. Not worried about resetting counts, etc. since I do this manually every once in a while when I turn off the forums for maintenance.

I have a couple of FSOT type forums and we try to keep them pruned, but don't always do it!

Thanks!
Dan
Reply With Quote
  #2  
Old 01-29-2004, 12:12 PM
allan grossman allan grossman is offline
 
Join Date: Apr 2003
Location: surreal city, usa
Posts: 163
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm interested in this also - as I'm running a Usenet gateway and don't really need to keep more than six months' worth of posts.

I'd also like to see this incorporated with a cron job to flush and rebuild the search index. Anybody got ideas?
Reply With Quote
  #3  
Old 02-25-2004, 06:52 AM
MRaburn MRaburn is offline
 
Join Date: Dec 2001
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think this is much needed but have never really found anyone in the VB arena to take the time to make something for the bigger boards. I've been waiting for years.
Reply With Quote
  #4  
Old 02-25-2004, 08:43 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Indyshooter
Try this:
  1. [sql]ALTER TABLE forum ADD pruneafter INT DEFAULT 0 NOT NULL[/sql]
  2. In admincp/forum.php FIND
    PHP Code:
    print_yes_no_row($vbphrase['warn_administrators'], 'options[warnall]'$forum['warnall']); 
    BELOW that ADD
    PHP Code:
    print_input_row("Prune After<dfn>Stetting this to a value > 0 will automatically prune all threads from this forum where the last reply is older then the set amount of days</dfn>"'forum[pruneafter]'$forum['pruneafter']); 
  3. Place the following as prune.php in includes/cron
    PHP Code:
    <?php
    error_reporting
    (E_ALL & ~E_NOTICE);

    if (
    $DB_site == NULL)
    {
        exit;
    }

    require_once(
    './includes/functions_databuild.php');
    $forums $DB_site->query("SELECT forumid, pruneafter FROM " TABLE_PREFIX "forum WHERE pruneafter > 0");
    while (
    $forum $DB_site->fetch_array($forums)) {
      
    $threads $DB_site->query("SELECT threadid FROM " TABLE_PREFIX "thread WHERE forumid=$forum[forumid] AND lastpost <= " . (TIMENOW - ($forum['pruneafter'] * 86400)));
      while (
    $thread $DB_site->fetch_array($threads)) {
        
    delete_thread($thread['threadid'], 0);
      }
      
    build_forum_counters($forum['forumid']);
    }

    log_cron_action('Forums pruned'$nextitem);

    ?>
  4. Go to Forum Manager, Edit the Forums you want to be pruned automatically and set the number of days
  5. Create a Cron Job for prune.php

Use AS-IS, no warranties.
Reply With Quote
  #5  
Old 02-29-2004, 06:44 PM
EricR EricR is offline
 
Join Date: Feb 2004
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Many thanks Kirby, this is just what I was looking for I just have a few questions.

1) If I add a new forum later do I have to rerun the query?

2) Will this ignore sticky topics? If I have something as a sticky I'd like it to be exempt from any/all pruning functions including this auto-prune.


I have this installed and I've setup a few "tests" to confirm that it is working. I ran the task manually and it appears to work, I'll know more tomorrow after the scheduled task runs
Reply With Quote
  #6  
Old 03-01-2004, 12:03 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
If I add a new forum later do I have to rerun the query?
No. You will just have to set the amount of days in forum manager.

Quote:
ill this ignore sticky topics? If I have something as a sticky I'd like it to be exempt from any/all pruning functions including this auto-prune.
No, it will also delete sticky threads. But this can be modified easily:

Replace
PHP Code:
$threads $DB_site->query("SELECT threadid FROM " TABLE_PREFIX "thread WHERE forumid=$forum[forumid] AND lastpost <= " . (TIMENOW - ($forum['pruneafter'] * 86400))); 
With
PHP Code:
$threads $DB_site->query("SELECT threadid FROM " TABLE_PREFIX "thread WHERE forumid=$forum[forumid] AND sticky != 1 AND lastpost <= " . (TIMENOW - ($forum['pruneafter'] * 86400))); 
Then it should ingore sticky threads.
Reply With Quote
  #7  
Old 03-01-2004, 12:42 AM
EricR EricR is offline
 
Join Date: Feb 2004
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you!
Reply With Quote
  #8  
Old 03-03-2004, 11:16 PM
EricR EricR is offline
 
Join Date: Feb 2004
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just wanted to say thanks again Kirby, the script passed all of my tests All of the expired posts (open and closed) were automatically deleted and the sticky posts were unharmed Excellent!
Reply With Quote
  #9  
Old 03-04-2004, 06:17 AM
Limitter Limitter is offline
 
Join Date: Aug 2002
Location: Germany
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Modyfication by Pogo

http://www.vbulletin-germany.com/for...&threadid=9253

Limitter
Reply With Quote
  #10  
Old 03-27-2004, 03:26 PM
Catch-22|BL Catch-22|BL is offline
 
Join Date: Aug 2003
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

KirbyDE, I would encourage you to release your post as a hack. People will appreciate this information because it is useful for many large boards. I have to spend at least five hours a month sitting at my computer to manually do the prunes and it is very annoying.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:07 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06590 seconds
  • Memory Usage 2,268KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete