Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Automatic Zero-Reply Pruning Details »»
Automatic Zero-Reply Pruning
Version: 1.0.0, by Revan Revan is offline
Developer Last Online: Jun 2014 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 03-30-2005 Last Update: 04-19-2005 Installs: 3
 
No support by the author.

This hack was requested by T3MEDIA here.


What this hack does:
  • Runs a cronjob every 15 days, deleting threads with zero replies
  • Uses vBulletin own thread deletion function. Accept no BS
  • Rebuilds forum counters after thread deletion. Clean!

Well thats about it

Show Your Support

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

Comments
  #12  
Old 04-19-2005, 06:15 PM
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Location: Norway
Posts: 1,671
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

try adding this right above the $prunedthreads query start:
PHP Code:
require_once('./includes/functions_databuild.php'); 
Reply With Quote
  #13  
Old 04-19-2005, 06:17 PM
Bounce's Avatar
Bounce Bounce is offline
 
Join Date: Mar 2004
Location: Edinburgh,Scotland
Posts: 919
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Revan
try adding this right above the $prunedthreads query start:
PHP Code:
require_once('./includes/functions_databuild.php'); 
ok thanks,before I do will this change my forums post counts..

as per "Rebuilds forum counters after thread deletion. Clean!"

Ideally I would want the users to have the same postcount,there an awful moany bunch lol
Reply With Quote
  #14  
Old 04-19-2005, 10:50 PM
Bounce's Avatar
Bounce Bounce is offline
 
Join Date: Mar 2004
Location: Edinburgh,Scotland
Posts: 919
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Worked a treat



thank you for a great hack, just a little Question

If I change the WHERE `replycount` = '0' to "1" will it work in the same way ?
Reply With Quote
  #15  
Old 04-20-2005, 05:52 AM
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Location: Norway
Posts: 1,671
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1. Im not sure if it changes the USERs postcounts, but it changes the FORUMs.
2. If you do that change, it will prune all threads where replies is EXACTLY 1. IE not 0 or 2, but 1.
If you want it to prune threads where reply count is 1 or less, then do WHERE `replycount`<= '1'
Reply With Quote
  #16  
Old 04-20-2005, 02:26 PM
Bounce's Avatar
Bounce Bounce is offline
 
Join Date: Mar 2004
Location: Edinburgh,Scotland
Posts: 919
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Revan
1. Im not sure if it changes the USERs postcounts, but it changes the FORUMs.
2. If you do that change, it will prune all threads where replies is EXACTLY 1. IE not 0 or 2, but 1.
If you want it to prune threads where reply count is 1 or less, then do WHERE `replycount`<= '1'

Brilliant stuff Revan,well done,works great,changes post count and forum stats,

Not to worry thou i'm happy with it...

Thanks again :up:
Reply With Quote
  #17  
Old 04-20-2005, 02:48 PM
T3MEDIA T3MEDIA is offline
 
Join Date: Dec 2004
Posts: 944
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Minor snag...

Some fourms have news areas and articles. where no one posts.
Could this have a tiny mod to ignore these forum id's?
Reply With Quote
  #18  
Old 04-21-2005, 10:40 AM
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Location: Norway
Posts: 1,671
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Add a variable like so:
PHP Code:
$ignoreids '4, 5, 6, 7, 8'// or whatever your ignore ids is 
change the SQL
Code:
WHERE `replycount` = '0'  AND `forumid` NOT IN($ignoreids)
That should work OK. It is important that the variable has comma seperated values tho, else the SQL will complain.
You might want to try running the script right after applying the changes to test it, instead of not seeing the errors and thinking it runs OK
Reply With Quote
  #19  
Old 04-21-2005, 11:00 AM
T3MEDIA T3MEDIA is offline
 
Join Date: Dec 2004
Posts: 944
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Revan
Add a variable like so:
PHP Code:
$ignoreids '4, 5, 6, 7, 8'// or whatever your ignore ids is 
change the SQL
Code:
WHERE `replycount` = '0' AND `forumid` NOT IN($ignoreids)
That should work OK. It is important that the variable has comma seperated values tho, else the SQL will complain.
You might want to try running the script right after applying the changes to test it, instead of not seeing the errors and thinking it runs OK
Thaaan-Q!
Reply With Quote
  #20  
Old 05-04-2005, 09:27 AM
almqdad almqdad is offline
 
Join Date: Jul 2003
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

great hack
Reply With Quote
  #21  
Old 05-06-2005, 03:04 AM
djr's Avatar
djr djr is offline
 
Join Date: Nov 2001
Location: Amsterdam
Posts: 220
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I must be pretty stupid, but I made a modification of this cron job to prune closed threads (not sticky) and I just can't get them to delete :'(

Any help would be appreciated!
PHP Code:
<?php
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 3.0.7 - Licence Number
|| # ---------------------------------------------------------------- # ||
|| # Copyright ?2000?2005 Jelsoft Enterprises Ltd. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

if (!
is_object($DB_site))
{
    exit;
}

// ##########
// # Config #
// ##########
// Enter the forum id's of the forums to prune here
$forumpruneids '27,28,29';

// Set this to 1 if you want to remove the threads physically, 0 to soft delete
$deletetype 0;

// The deletion info, for DB inserts
$delinfo = array('userid' => $bbuserinfo['userid'], 'username' => $bbuserinfo['username'], 'reason' => 'Auto-Pruned Thread');
// ##############
// # End Config #
// ##############

require_once('./includes/functions_databuild.php');

$prunedthreads $DB_site->query("SELECT * FROM " TABLE_PREFIX "thread WHERE open = 0 AND sticky != 1 AND forumid IN ($forumpruneids)");
while (
$threads $DB_site->fetch_array($prunedthreads))
{
    
delete_thread($threads['threadid'], 1$deletetype$delinfo);
    
build_forum_counters($threads['forumid']);
    echo 
"Pruned Thread: $threads[threadid]<br />";
}

log_cron_action('Threads Pruned.'$nextitem);
/*======================================================================*\
|| ####################################################################
|| # Created: 4:15, Fri May 6th 2005
|| # CVS: $RCSfile: deleteclosed.php,v $ - $Revision: 1.00 $
|| ####################################################################
\*======================================================================*/
?>
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 06:38 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.04681 seconds
  • Memory Usage 2,319KB
  • Queries Executed 25 (?)
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_code
  • (5)bbcode_php
  • (3)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
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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