Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-24-2010, 02:57 PM
SBoards SBoards is offline
 
Join Date: Oct 2007
Location: Albany, NY
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Anyone know of a SQL script I can use?

Hi folks,

I am running vbulletin 4.0.3. A few months ago, my upgrade from 4.0.1 produced bad results. I then restored my database from backup, but my backup apparently wasn't complete. Unfortunately, I had no other good backups.

I was able to salvage my users, which was a relief. But, losing thousands of posts definitely caused me to learn my lesson.

Anyhoo... I now have a crapload of threads which think they have posts in them, but they don't. Does anyone know of a SQL script I can use to delete all the postless threads? I can't mass-prune threads with zero posts, because as I said... the threads still think they have posts in them.

Any help would be appreciated. Thanks!
Reply With Quote
  #2  
Old 07-24-2010, 03:48 PM
borbole's Avatar
borbole borbole is offline
 
Join Date: Jan 2010
Posts: 2,559
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SBoards View Post
Hi folks,

I am running vbulletin 4.0.3. A few months ago, my upgrade from 4.0.1 produced bad results. I then restored my database from backup, but my backup apparently wasn't complete. Unfortunately, I had no other good backups.

I was able to salvage my users, which was a relief. But, losing thousands of posts definitely caused me to learn my lesson.

Anyhoo... I now have a crapload of threads which think they have posts in them, but they don't. Does anyone know of a SQL script I can use to delete all the postless threads? I can't mass-prune threads with zero posts, because as I said... the threads still think they have posts in them.

Any help would be appreciated. Thanks!
Do you want to delete all threads with 0 replies? If so, run this query at phpmyadmin in the cp of your host:

Code:
DELETE FROM thread WHERE replycount = 0;
If your db tables use a prefix, append it to the table name when running the query. Hope it helps.
Reply With Quote
  #3  
Old 07-24-2010, 03:49 PM
SBoards SBoards is offline
 
Join Date: Oct 2007
Location: Albany, NY
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks for the suggestion!

the problem I'm having is that my thread table still has reply counts. it's the post table that is missing the info associated with those reply counts.
Reply With Quote
  #4  
Old 07-24-2010, 03:54 PM
borbole's Avatar
borbole borbole is offline
 
Join Date: Jan 2010
Posts: 2,559
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SBoards View Post
thanks for the suggestion!

the problem I'm having is that my thread table still has reply counts. it's the post table that is missing the info associated with those reply counts.
The reply count is not defined at the post table but the thread table. But you can also get the title or the id''s oth those threads that you want deleted and delete them directly from the db.

One more thing, a bit off topic, but I think it is best to upgrade your forum to the latest version as there are several known security issues from the version you are having.
Reply With Quote
  #5  
Old 07-24-2010, 04:09 PM
SBoards SBoards is offline
 
Join Date: Oct 2007
Location: Albany, NY
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

that's the problem I'm having. the thread table thinks there's replies because that is where the reply count is defined. this causes me to have no idea which threads I want to delete due to a lack of corresponding posts in the post table.

If you look at this thread for example... the opening post isn't even there. But if you back out to the forum, and locate the thread, it claims to have four replies. I can't figure out how to define the threads that don't actually, physically have posts in them.

I agree... and I would love to upgrade to the latest and greatest, but I'm reading nothing but bad things about 4.0.5. I'm hoping they'll soon release a version that more people are happy with.
Reply With Quote
  #6  
Old 07-24-2010, 05:11 PM
borbole's Avatar
borbole borbole is offline
 
Join Date: Jan 2010
Posts: 2,559
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SBoards View Post
that's the problem I'm having. the thread table thinks there's replies because that is where the reply count is defined. this causes me to have no idea which threads I want to delete due to a lack of corresponding posts in the post table.

If you look at this thread for example... the opening post isn't even there. But if you back out to the forum, and locate the thread, it claims to have four replies. I can't figure out how to define the threads that don't actually, physically have posts in them.

I agree... and I would love to upgrade to the latest and greatest, but I'm reading nothing but bad things about 4.0.5. I'm hoping they'll soon release a version that more people are happy with.
Can you check the db and see if that threads contains the posts there? If it does, can you go to your Apc->Maintenance->Update Counters-> and run Rebuild Thread Information and Rebuild Forum Information?

Don''t believe all you read. There is nothing wrong with vb 4.0.5.
Reply With Quote
  #7  
Old 07-24-2010, 06:02 PM
SBoards SBoards is offline
 
Join Date: Oct 2007
Location: Albany, NY
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

'tis true... I read a lot of silly comments from people who don't know what they're talking about in threads about mods for vb. I suppose I should apply the same logic to threads about actual vb. lol

I've tried that, and it didn't update my thread replies field. I was surprised to see that it didn't, since the point of that is to correct these types of issues.
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 12:00 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.03948 seconds
  • Memory Usage 2,224KB
  • Queries Executed 13 (?)
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
  • (1)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)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_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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete