Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-19-2016, 09:11 PM
Skyrider Skyrider is offline
 
Join Date: Feb 2006
Location: Netherlands
Posts: 1,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Remove Avatars if file is non-existing in local/filestorage

There were over 5.000 broken file avatars within customavatars directory of which I had to remove. But thus far, vBulletin does not support anyway to remove the attached avatars from the users if the file no longer exists on the filesystem (not database). For funsies, I've rebuild the custom avatars, and didn't work at all.

I noticed that kh99 has created a php file here:
https://vborg.vbsupport.ru/showthread.php?t=281878

https://vborg.vbsupport.ru/attachmen...8&d=1335042680

But I'm afraid I'm getting a database error with it:

Quote:
Database error in vBulletin 4.2.3:

Invalid SQL:
DELETE FROM customavatar WHERE userid IN(4165,,4168,4169,4173,4174,4175,4176,4177,4178,4 179,4180,4181,4182,4185,4189,4 190,4192,4193,4195,4196,4198,4199,4201,4203,4204,4 205,4210,4212,4215,4216,4218,4 220,4221,4222,4223,4224,4225,4227,4229,4231,4234,4 235,4236,4238,4241,4242,4243,4 244,4245,4246,4247,4248,4249,4252,4254,4255,4256,4 257,4260,4261,4262,4263,4265,4 266,4268,4269,4270,4271,4272,4273,4275,4276,4278,4 279,4281,4282,4284,4285,4287,4 288,4290,4291,4294,4295,4296,4297,4298,4299,4301,4 302,4304,4306,4307,4309,4310,4 311,4314,4316,4317);

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '4168,4169,4173,4174,4175,4176,4177,4178,4179,4180 ,4181,4182,4185,4189,4190,4192 ,' at line 1
Error Number : 1064
and:

Quote:
PHP Warning: mysqli_query(): (42000/1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '4168,4169,4173,4174,4175,4176,4177,4178,4179,4180 ,4181,4182,4185,4189,4190,4192 ,' at line 1 in ..../includes/class_core.php on line 1394
I've already PM'd kh99 regarding this, but I am unsure when he'll visit the forums again or if he would read my pm in regards of the no-pm policy he has. I appreciate all the help I can get .
Reply With Quote
  #2  
Old 02-23-2016, 07:51 AM
Skyrider Skyrider is offline
 
Join Date: Feb 2006
Location: Netherlands
Posts: 1,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone? I appreciate all the help I can get.
Reply With Quote
  #3  
Old 02-23-2016, 02:09 PM
squidsk's Avatar
squidsk squidsk is offline
 
Join Date: Nov 2010
Posts: 969
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Based on the code, it looks like you have entries in the customavatar table that correspond to users that have previously been deleted and those ids are what causing you problems.

If you run the following query it should remove all entries from the customavatar table that do not correspond to existing users.
Code:
DELETE FROM customavatar WHERE NOT userid IN (SELECT userid FROM user)
Backup the customavatar table before running the query just in case.
Reply With Quote
2 благодарности(ей) от:
MarkFL, Skyrider
  #4  
Old 02-24-2016, 09:13 AM
Skyrider Skyrider is offline
 
Join Date: Feb 2006
Location: Netherlands
Posts: 1,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by squidsk View Post
Based on the code, it looks like you have entries in the customavatar table that correspond to users that have previously been deleted and those ids are what causing you problems.

If you run the following query it should remove all entries from the customavatar table that do not correspond to existing users.
Code:
DELETE FROM customavatar WHERE NOT userid IN (SELECT userid FROM user)
Backup the customavatar table before running the query just in case.
Love, thanks! Using that query and re-running the php file worked like a charm:

Quote:
Removed 22011 rows from customavatar
Reply With Quote
  #5  
Old 02-24-2016, 10:53 AM
blind-eddie's Avatar
blind-eddie blind-eddie is offline
 
Join Date: Apr 2006
Location: Michigan
Posts: 2,310
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Awesome, I will be trying this shortly.
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 10:29 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.03920 seconds
  • Memory Usage 2,212KB
  • 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
  • (2)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (2)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