vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   5000 entries in db for same file (https://vborg.vbsupport.ru/showthread.php?t=323342)

webmaster74 08-25-2016 12:36 PM

5000 entries in db for same file
 
Checking on my vbulletin 4 forums, I came across tens of ablums with 100% broken links to their uploaded images.

Looking in the attachment table, I found about 5000 entries all referring to the same file. Looking closely, the file is named keyword1_keyword2_keyword3_keyword4_keyword5_keywo rd6_keyword7_keyword8_keyword9_keyword10_keyw_.jpg

OK I got it. A few years ago, I created some nice designs and pushed the SEO a bit too much by naming the files in the above way.

I don't have those designs as I was very short on space on my SSD. After uploading them as attachments, I deleted them from my pc. They then looked fine...

Now, the attachments are fine in their proper places as /n/n/filedataid.attach

Can I fix this by renaming the files in the DB? I am good at manipulating data in Excel and re-uploading with a replace order to the DB.

it would be a real pitty to have to delete 5000 files and re-create and re-upload.

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

This should not be very difficult to do as the files are not encrypted or modified except that they are renamed to filedataid.attach

I tried simply renaming one of them to filedataid.attach.jpg and I could easily open it as a jpg.

I know for a fact all of those files in question were jpg...

I was thinking I am able to write a replace / update statement such as

update attachment where filedataid=nnnnn set filename=new_short_name_filedataid.jpg

RichieBoy67 08-25-2016 10:56 PM

Can you share a link to your site? I'm very confused. You said it's fine?

webmaster74 08-26-2016 12:26 AM

Quote:

Originally Posted by RichieBoy67 (Post 2575247)
Can you share a link to your site? I'm very confused. You said it's fine?

I said the attachments are fine in their places, that is they are indeed where you expect them to be ... in the attachments folder. However, they do not show up at all on the website....

Dave 08-26-2016 12:58 AM

So it's incorrectly stored in the database? Can you show us an example of what it looks like in the database and what it's supposed to look like?

webmaster74 08-26-2016 01:01 AM

Quote:

Originally Posted by Dave (Post 2575250)
So it's incorrectly stored in the database? Can you show us an example of what it looks like in the database and what it's supposed to look like?

Hi Dave.

I have about 5000 entries in the attachment table with this under filename

keyword1_keyword2_keyword3_keyword4_keyword5_keywo rd6_keyword7_keyword8_keyword9 _keyword10_keyw_.jpg

Of course originally the entries were like

keyword1_keyword2_keyword3_keyword4_keyword5_keywo rd6_keyword7_keyword8_keyword9 _keyword10_keyword11_some_serial_number.jpg


Of course I can mass modify the entries in the mysql db... but how do those tie back with the attachments ?

Dave 08-26-2016 01:06 AM

If I recall correctly, there's no strict check against the filename column in the attachment table. What matters the most is that the attachmentid exists in the attachment table.

Browsing to /attachment.php?attachmentid=XX where XX is a valid attachmentid in your table does not download/load the attachment?

webmaster74 08-26-2016 01:20 AM

Quote:

Originally Posted by Dave (Post 2575252)
If I recall correctly, there's no strict check against the filename column in the attachment table. What matters the most is that the attachmentid exists in the attachment table.

Browsing to /attachment.php?attachmentid=XX where XX is a valid attachmentid in your table does not download/load the attachment?

thank you for this.

On the website, the source of the images in the album is something like this:
PHP Code:

http://domain.com/forum/attachment.php?attachmentid=20027&d=1426709651 


and those do not lead to an image... they are broken links.

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

Quote:

Originally Posted by Dave (Post 2575252)
If I recall correctly, there's no strict check against the filename column in the attachment table. What matters the most is that the attachmentid exists in the attachment table.

Browsing to /attachment.php?attachmentid=XX where XX is a valid attachmentid in your table does not download/load the attachment?

I apologize.... I most humbly say I am sorry....

I now recalled, thanks to you, that after the migration to a new server I did NOT update the path to the vbattachments folder.

So sorry. Fixed now.

Dave 08-26-2016 01:35 AM

But does the attachmentid 20027 exist in the attachment table?
If so, it's probably not passing a bunch of checks that are coded in /packages/vbforum/attach/album.php or /packages/vbforum/attach/post.php (look for function verify_attachment) Based on those checks, you can see what's wrong and causing the attachment to "break".

Edit: guess you figured it out. :)

webmaster74 08-26-2016 03:20 AM

Quote:

Originally Posted by Dave (Post 2575257)

Edit: guess you figured it out. :)

You did, when you mentioned that the filename does not matter.... you logically lead me to conclude that if the files are available in their folder, then ... it is the path to them that is broken!

thank you much


All times are GMT. The time now is 10:54 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.01132 seconds
  • Memory Usage 1,738KB
  • 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)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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