vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Delete certain posts from a user with specific content? (https://vborg.vbsupport.ru/showthread.php?t=55393)

Areku 07-18-2003 06:24 PM

Delete certain posts from a user with specific content?
 
Hi!

I need to delete (let's say) 500 out of 1000 messages of a user, where content of the post is equal (always) to a certain string.

How can I achieve that and that will still deduct them from the user's post count plus not corrupting any table/database?

Please be as specific as possible!

Thanks!

SmEdD 07-18-2003 09:06 PM

DELETE FROM $table WHERE $userid, $column LIKE '%$string%';

$table = What table (post, privatemessages)
$userid = User id (first user is 1)
$column = What part of the table is the string in (message)
$string = Phrase or word

I'm not 100% that will work, that was off top my head. Also after you have to update the counts via admin panel.

Areku 07-18-2003 10:11 PM

Just did
DELETE FROM post WHERE pagetext LIKE '%string%' AND username LIKE '%username%';

and it seems it worked nice.

Thanks!

Areku 07-18-2003 10:25 PM

mmmmmmmmmmm.......... errrrr.......

Houston we've got a problem!!

Right after running the query, I updated user counts.

THen, I searched for this user via FORUM SEARCH and then clicked on the SEE ALL POSTS FOR THIS USER.

Seems some of the threads this user was participating show NO FORUM related to when you search for all posts for this user.

And upon clicking on them it leads to a PAGE NOT FOUND error on the browser.

What's going on?

Areku 07-18-2003 10:31 PM

It matches the description of an orphan thread, but I just deleted POSTS from a single user! I don't want to loose the rest of the thread the offending message was in, so how could I fix this?

Thanks!

Areku 07-18-2003 10:47 PM

Woah!

There's more!

Doing further research and queries, I notice problematic threads not appearing on the search results lead to a forumid which does not exist.

Quering that forumid in table threadid throws... 257 records!

257 threads pointing to a non existant forumid!

How can this be possible?

Now, is there any query that would allow me to FIND (not delete!) ORPHAN threads? Ie threads pointing to invalid forumids? (ie forumids no longuer existing!)

Where can this problem come from?

I've managed to run tables check in a monthly basis with no errors ever!

DB is around 200Mb, including attachments.

Please advice.

Thanks!


All times are GMT. The time now is 05:54 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.01010 seconds
  • Memory Usage 1,714KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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