vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Automatic Zero-Reply Pruning (https://vborg.vbsupport.ru/showthread.php?t=79120)

Revan 03-30-2005 10:00 PM

Automatic Zero-Reply Pruning
 
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 :)

kall 03-31-2005 05:39 PM

Odd... your php file seems to be a ph p file.

:)

tnguy3n 03-31-2005 05:44 PM

I'd look to thread table, and check for dateline = lastpost date. If they'r the same, then prune the thread (excepts for ones of admins). ;)

edit: nvm me. lol

Revan 03-31-2005 06:37 PM

Quote:

Originally Posted by kall
Odd... your php file seems to be a ph p file.

:)

Reupped the attachment, and it stays that. It looks fine in Edit Post and on my desktop tho... :ermm:

Marco van Herwaarden 03-31-2005 07:31 PM

Looks like a ph p file here also. But saving as php, strange.

T3MEDIA 04-02-2005 01:04 PM

Question does it have usergroup permision? Thank you btw.
edit just looked it over. It does.

Bounce 04-17-2005 10:06 PM

has anyone installed this ?

what will happen if I install it with 137,000 posts on my forumjust now...

will it delete the current 0 reply's ??? or will it only be from when I install it :nervous:

Bounce 04-18-2005 07:56 PM

It says I have an error

Fatal error: Call to undefined function: delete_thread() in /var/www/html/forum/includes/cron/deletezerothreads.php on line 49

line 49 is:- "delete_thread($threads['threadid'], 1, $deletetype, $delinfo);"

I uploaded to /var/www/html/forum/includes/cron/ ???? :ermm: Is this right??

Marco van Herwaarden 04-18-2005 08:31 PM

How are you running it? By directly going to the URL?

Bounce 04-18-2005 08:32 PM

Quote:

Originally Posted by MarcoH64
How are you running it? By directly going to the URL?

in admin cp

scheduled tasks "RUN NOW"
then the error comes up :rolleyes:

Edit:-I've took a screenie of it..am thinking its a typo in the file..I uploaded in ANSI

Revan 04-19-2005 06:15 PM

try adding this right above the $prunedthreads query start:
PHP Code:

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


Bounce 04-19-2005 06:17 PM

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

Bounce 04-19-2005 10:50 PM

Worked a treat https://vborg.vbsupport.ru/external/2005/04/3.gif



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 ?

Revan 04-20-2005 05:52 AM

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'

Bounce 04-20-2005 02:26 PM

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:

T3MEDIA 04-20-2005 02:48 PM

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?

Revan 04-21-2005 10:40 AM

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 ;)

T3MEDIA 04-21-2005 11:00 AM

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!

almqdad 05-04-2005 09:27 AM

great hack

djr 05-06-2005 03:04 AM

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 $
|| ####################################################################
\*======================================================================*/
?>



All times are GMT. The time now is 02:58 PM.

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.01115 seconds
  • Memory Usage 1,779KB
  • 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
  • (2)bbcode_code_printable
  • (5)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (20)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete