Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases

Reply
 
Thread Tools
Cron job: Prune forums Details »»
Cron job: Prune forums
Version: 1.00, by jamoss jamoss is offline
Developer Last Online: Jan 2021 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 02-11-2003 Last Update: Never Installs: 5
 
No support by the author.

If you get the kind of traffic like we do-- average 2,000 messages post per day-- you need to do a lot of pruning.

Here's a hack that will automatically run a script daily (or weekly) that will select forums to prune, choose how old the pruned threads must be, deletes the threads, then updates the thread and post counts (all configurable). Author assumes that you have access to your server's filesystem and can edit your crontab file, located in /etc

Steps:

1. Edit your crontab file (in /etc) and add one of these lines:

If you want to run it DAILY at 12:01am
01 00 * * * root /usr/local/bin/php /fullpath/to/yourboard/admin/cron_prune.php >dev/null

If you want to run it WEEKLY, every SUNDAY at 12:01am
01 00 * * 0 root /usr/local/bin/php /fullpath/to/yourboard/admin/cron_prune.php >dev/null

(replace /fullpath/to/yourboard/admin/ with the actual server path to your vB admin directory)

2. Put the attached file (cron_prune.php) in your board's admin directory.

3. Edit the cron_prune.php file and enter your own settings at the top of the file.

If you have any questions, post them here (I'll subscribe to this thread) or email me at jennifer@babynames.com

Let me know if it works for ya! It works for us!
Jenn

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 04-11-2003, 03:47 PM
jamoss's Avatar
jamoss jamoss is offline
 
Join Date: Apr 2002
Location: Los Angeles
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, Ryan!

You can run the script manually from the browser to see if it's working for you, but note that you will not receive any output in the browser. When it's done, it will either just stop running with a blank screen or say "No Data".

Jennifer.
Reply With Quote
  #13  
Old 04-13-2003, 09:44 PM
ImportPassion ImportPassion is offline
 
Join Date: Mar 2002
Location: Gilbert, AZ
Posts: 605
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

just a note, foe some reason my global.php had this.
PHP Code:
if ($bbuserinfo[userid]==and $checkpwd) { 
instead of this
PHP Code:
if ($bbuserinfo[userid]==&& $checkpwd) { 
I have 2.2.9. So if you have trouble finding that line, this may be why.

Derek
Reply With Quote
  #14  
Old 04-20-2003, 12:53 PM
ryancooper ryancooper is offline
 
Join Date: Jul 2002
Posts: 433
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
04-12-03 at 04:47 AM jamoss said this in Post #11
Thanks, Ryan!

You can run the script manually from the browser to see if it's working for you, but note that you will not receive any output in the browser. When it's done, it will either just stop running with a blank screen or say "No Data".

Jennifer.

Well it works but I get a database error:

Database error in vBulletin Control Panel 2.3.0:

Invalid SQL: DELETE FROM searchindex WHERE wordid IN (0) AND postid=
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

mysql error number: 1064

Date: Sunday 20th of April 2003 08:51:59 AM
Script: http://www.talkdisney.com/forums/for...cron_prune.php
Referer:

could this be because i emptied my searchindex to save space?
Reply With Quote
  #15  
Old 05-22-2003, 10:06 AM
ImportPassion ImportPassion is offline
 
Join Date: Mar 2002
Location: Gilbert, AZ
Posts: 605
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

any idea why I get this when trying to run this on command line

[root@srv1 forums]# php -q /home/virtual/site1/fst/var/www/html/forums/admin/cron_prune.php

Warning: main(./config.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /home/virtual/site1/fst/var/www/html/forums/admin/global.php on line 96

yet if I go direct to the admin dir and run the script w/o the whole path but with just the file, it works no prob.

D
Reply With Quote
  #16  
Old 05-22-2003, 02:00 PM
jamoss's Avatar
jamoss jamoss is offline
 
Join Date: Apr 2002
Location: Los Angeles
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

look in global.php and see what it's trying to do on line 96.
Reply With Quote
  #17  
Old 07-04-2003, 05:51 AM
tpearl5's Avatar
tpearl5 tpearl5 is offline
 
Join Date: Nov 2001
Location: PA
Posts: 1,014
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just what I needed! Thanks! I think there's a lot of people that are looking for something like this but didn't type in the right search terms to find it. Works great in combination with the newsgroup hack for deleting old threads that can take up extra space.
Reply With Quote
Reply

Thread Tools

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 02:02 AM.


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.04581 seconds
  • Memory Usage 2,263KB
  • Queries Executed 23 (?)
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
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (6)postbit
  • (7)postbit_onlinestatus
  • (7)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_postinfo_query
  • fetch_postinfo
  • 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