Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-26-2014, 02:47 AM
BowlingTracker BowlingTracker is offline
 
Join Date: May 2014
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Delete Sent folder via SQL (or other ideas)

After upgrading to vB5 and putting it into production last night, I tried to send a PM to my mods, only to discover I was about 30k messages above my 500 quota and it wouldn't let me send.

It seems that for every member that has ever joined my forum, there is a "welcome" message in my sent box. Nearly 2000 pages of sent pm's!

How can I purge my sent box? I can't "select all/delete" 2000 times. Or at least, I don't want to.

Help.

Thanks.
Reply With Quote
  #2  
Old 08-29-2014, 12:13 PM
BowlingTracker BowlingTracker is offline
 
Join Date: May 2014
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone have a clue how I can purge my sent folder w/o having to do select all delete on all 2000 pages? I'm okay with a SQL script, if that's what it takes.

Thanks
Reply With Quote
  #3  
Old 08-29-2014, 03:12 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think you need to write a script. You have all messages listed in the privatemessage table (under the nodeid) and then they are also listed in the node table and closure table (nodeid as both a parent and a child).
Reply With Quote
  #4  
Old 09-02-2014, 01:37 AM
BowlingTracker BowlingTracker is offline
 
Join Date: May 2014
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Lynne,

Thanks for your help.. I see how vb_node and vb_privatemessage are tied by nodeid. But when deleting one from the UI, it doesn't delete it from these tables. So I tracked down how vb_sentto table holds the folderid for the message.

That led to a bigger problem.

I found vb_messagefolder has duplicates for my userid! (UserId 1 only). Everything except "sent_items" and "messages" is duplicated. ie. trash is listed twice with id's 62642 and 62643.

If i click the trash folder in the UI, the url shows folderid 62642 and the trash folder appears empty. (even though I have deleted some messages). For the messages that I deleted via the UI, the vb_sentto folder shows them in folder id 62643. Which is why I can't see them in the UI. If I change the URL to 62643, I can see the messages that I previously deleted.

I'm assuming this is going to require a manual fix.

Can I just delete the row from vb_message folder for "trash" id 62642. Will the UI start using the other one to show the trash folder? or should I update all the data to that points to folderid 62643 and change them to 62642 and then delete 62643 folder? Will it start moving them to the right folder when I delete via the UI?

If your unsure, I'll dig into the code or just try it and see what happens. Just wanted to see what your thoughts were before I go down the wrong path.

Thanks again.

--------------- Added [DATE]1409630782[/DATE] at [TIME]1409630782[/TIME] ---------------

I got it straightened out now.

All via SQL:
I updated all the vb_sentto rows tied to folderid 62643 to 62642, then renamed the 62643 trash folder to something else. (Tested to makes sure that was working right in the UI. Perfect!)

Then renamed all the other dupes rows in vb_sentto. I kept the lower id's and renamed the ones with higher id's. All seems to be functioning well in UI, so I deleted the rows that I had renamed.

Finally, to get rid of the 2000 pages of sent welcome messages, I executed this SQL:

(Note to others, the folderid and title text is particular to my install only. If you use this SQL, make sure you know what your doing and update it accordingly!)

update vb_sentto
set folderid = 62642, deleted = 1
where userid= 1 and nodeid in (
select nodeid
from vb_node n
where n.userid = 1
and n.contenttypeid = 15
and n.title like 'Welcome to BowlingTracker.com%');
Reply With Quote
Благодарность от:
Lynne
  #5  
Old 09-02-2014, 03:20 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm glad you got it all sorted out. Thanks for posting what you did - it may help someone else down the line.
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:56 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.06526 seconds
  • Memory Usage 2,202KB
  • 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)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (1)post_thanks_box_bit
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete